[logback-user] Externalized Logback configuration for web applications

Perryn Fowler pezlists at gmail.com
Fri Aug 17 06:23:46 CEST 2012


Hello,

I have a logging use case that I would think was relatively common,
but that does not seem to be supported particularly well by logback.
I wanted to see what the logback community thinks/advises.

The details of the use case
- I am writing java web apps to be deployed to JEE web containers.
- I want the logging config to be external to the wars, so that I can
use the same wars in different environments, but configure logging
differently.
- I want to be able to deploy several different wars to the same web
container and have them use different logging configurations.

The logback documentation seems to push towards either packaging the
logback config in the wars, or sharing an external logging config
between them.
(Whereas I want separate external logging configuration for each war)

I hope that makes sense.

The JNDI support described here:
http://logback.qos.ch/manual/loggingSeparation.html looks like it
might be of use, but it does seem to require that the config files are
placed in WEB-INF/classes and I would prefer they are completely
external to the war.

I have found a number of people who have coded up their own solutions, notably:
http://blog.iprofs.nl/tag/logback/ and https://bowerstudios.com/node/896

That doesn't look too bad, but wondering what the community thinks of
these approaches

-- 
-----------------------
Perryn Fowler


More information about the Logback-user mailing list