[logback-user] Reloading a Jndi Based Context

Greg Case greg.case at gmail.com
Fri Jul 13 16:36:53 CEST 2007

I'm currently migrating our internal project from log4j to sl4fj/logback,
and so far have been having pretty good results.    Because we have
multitple web-apps running under tomcat,
I'm using the JNDI context selectors as described at
http://logback.qos.ch/manual/contextSelector.html . The problem I am having
is that I wish to be able to set a system property at runtime to describe to
set the directory for logging destination to the WEB-INF/logs folder of the

So I am setting a system property of appname.log.home to
..../appname/WEB-INF/logs, and then referring to it in the jndi-specifc
logback.xml as ${appname.log.home to }/cc.log.   Very similar to the
InitContextListener in the log4j sandbox.

However, I don't believe the system property is being set in time.  How can
I tell the Context to reload itself, so the system property can then be

The reason for all of this is so that the default configuration for
development purposes puts the logs into the WEB-INF directory, but so that I
can take the same WAR, move it to production, modifying the the environment
variable logback/configuration-resource for the application to point to a
separate logback.xml file

Anyone have any ideas?   Should I scrap the JNDI contexts and just use the
JoranConfigurator to reload the config in a ServletContextListener?


Greg Case
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://qos.ch/pipermail/logback-user/attachments/20070713/d4bd619f/attachment.htm 

More information about the Logback-user mailing list