[logback-user] Externalized Logback configuration for web applications
pezlists at gmail.com
Mon Aug 20 06:30:28 CEST 2012
Thanks guys, it looks like the bit I was missing was the ability to
include externalized config files from a packaged config file.
On Sat, Aug 18, 2012 at 6:59 AM, ceki <ceki at qos.ch> wrote:
> On 17.08.2012 06:23, Perryn Fowler wrote:
>> 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
>> - I want to be able to deploy several different wars to the same web
>> container and have them use different logging configurations.
> Here is a simple recipe:
> 1) Package logback jars in each web-app separately.
> 2) In web-app A, place a logback.xml file which references an external file
> for inclusion. Example:
> # --- logback.xml shipping in web-app A -------
> <configuration debug="true">
> <include file="/opt/logback-A.xml">
> # ----------------------------------------------
> /opt/logback-A.xml would contains the config specific for web-app A.
> 3) Do the same for your other web-apps.
> 4) Declare victory.
> As Bjorn mention, you can parameterize the reference to the included file
> via JNDI (or any of the other variable types supported in logback).
> Logback-user mailing list
> Logback-user at qos.ch
More information about the Logback-user