[logback-user] ContextJNDISelector required in tomcat6 with logback-access?

kevko5212 . kevko5212 at gmail.com
Wed Jan 21 18:34:46 CET 2015


I have 2 webapps, each with their own maven dependencies of slf4j and
logback-classic declared, deployed to tomcat6. Each webapp writes to their
own log file. Works beautifully.

However, when deployed to a production tomcat6 configured with
logback-access, the webapp logback configs do not appear to be read and the
log files are not created.

If I add code to the contextInitialized() of my ServletContextListener like
the one found here:
http://logback.qos.ch/manual/configuration.html#joranDirectly
the log files are created for both webapps, but then log messages from both
webapps are written to only one of the log files.

I also found that if I add <contextName>WEBAPP_NAME<contextName> to the
logback config files of each webapp, where WEBAPP_NAME = unique name for
the given webapp, an error message pops up when deploying the 2nd webapp
saying something like "the context name has already been set to appA".

This leads me to believe that both apps are sharing the same Logger
Context, as described here:
http://logback.qos.ch/manual/loggingSeparation.html

I followed the steps to enable ContextJNDISelector, and it does now work.
Each webapp is logging to their respective log file.

However, there are a large number of other webapps that are deployed to the
same environment, and I am unsure of the impact enabling
ContextJNDISelector might have on them.

My question is, is something like ContextJNDISelector necessary on an
environment using logback access? Or should I be able to simply include the
necessary maven dependencies in appA and appB, and perhaps missed something
small along the way? Shouldn't tomcat's child-first class loading allow me
to do so?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150121/f65f995f/attachment.html>


More information about the Logback-user mailing list