[logback-user] configuration through JNDI

bjorn rohde jensen bjensen at fastmail.fm
Mon Jun 18 16:44:38 CEST 2012


Hi guys,

I recently switched to logback, and im trying to use JNDI to configure 
logback for webapps running in tomcat 6.

What i want to do is configure logging for each webapp using a different 
configuration file for each tomcat context. The logback configurations 
must be external to the wars and to the tomcat installation. Furthermore 
i cant rely on environment variables or -D options to the tomcat.

The only solution, i have come up with so far is to pack a skeleton 
logback configuration file in the war, which uses logbacks JNDI and 
include mechanisms to locate and include a file containing the real 
configuration like so:

<configuration scan="true" scanPeriod="5 minutes">
     <insertFromJNDI env-entry-name="java:comp/env/appName/logback" 
as="logbackConfiguration"/>

     <include url="${logbackConfiguration}"/>

</configuration>

While this does work, i would prefer being able to lookup the full 
configuration directly.

Is there a way to do this, or could one be added?


Yours sincerely,

Bjorn R. Jensen


More information about the Logback-user mailing list