Logging to server log on deploying a war file
I am using Jboss. I ne开发者_JS百科ed 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 ?
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
Hm, AFAIK JBoss will log that a new application was deployed by itself. Is that not sufficient?
精彩评论