[logback-user] Multiple webapps, one shared external configuration file

Thomas Meyer thomas at m3y3r.de
Mon Jun 20 17:15:02 UTC 2016


I stumbled upon this SO http://stackoverflow.com/questions/10465301/tomcat-war-configure-logback-to-use-app-name-in-path 

So is it a good idea to have multiple web apps all using the same config file? What is the potential drawback of above solution besides all app using the same default context?

The last sentence "Such involuntary sharing of the same configuration by multiple repositories will result in corrupt log output." from http://logback.qos.ch/manual/contextSelector.html implies some problems but doesn't explain why.

The underlying idea in log back seems to be this:
Always package the config file in your app, if you need a different test config also put test log back config file into your test class path.

Having multiple target environments with potentially different logging requirements doesn't fit above model and it would be good to externalise the log back config file. But sadly only one config file is supported with a system property.

So what is the best solution for having multiple web apps on a tomcat and having multiple target environment with potential different logging requirements.

What is a good solution pattern for this?

PS: using the JNDI ContextSelector only seems to search in the web app itself for the config file.

With kind regards 
Thomas Meyer

More information about the logback-user mailing list