views:

46

answers:

2

Hi,

I am using Jboss. I need to log "War file deployed" to server log when a war file is copied to jboss/server/default/log directory.( this's not related to jboss but still ... )

I am aware of one way to do is, i.e to have a servlet and overload the init methods, to log onto server log.

The requirement is -> as soon as a war file is deployed, it shud be able to log some info onto server log without overloading servlets.

Is it possible to do that ? Is it possible to specify something in web.xml to log something onto a server log ?

A: 

Hm, AFAIK JBoss will log that a new application was deployed by itself. Is that not sufficient?

Enno Shioji
True, but if i need to add some custom statements... Just wanted to know whether is there a way to do it ..
JWhiz
A: 

You can use the contextInitialized(ServletContextEvent sce) method in ServletContextListener and configure it in web.xml. But this will tell you when your context is started in the container. (Also when your war is deployed for the first time and every time your context starts or stops)

Check the documentation here

naikus
I agree that we can overload methods in listner.. It's one way of doing it.. I believe there are no other ways to specify logging via web.xml ..Where's the link ..? [here][1] is not hyperlinked..
JWhiz
@JWhiz Had forgotten to add the link, I've put it now
naikus
@naikus - Thanks
JWhiz