[logback-user] multiple apps deployed in Tomcat

Ceki Gülcü ceki at qos.ch
Mon May 30 22:23:51 CEST 2011


On 30/05/2011 3:10 PM, Nathaniel Auvil wrote:
> I want to deploy multiple applications in Tomcat. Each one will include
> Logback jars. I need to have the log configuration file external to the
> war so i can change them on the fly.  Is the "best" way to do this to
> have an init servlet in each application which loads from the
> filesystem?  I can pass a system property on Tomcat startup which points
> to a "config" directory.

Hello Nathaniel,

You could include an external configuration file on a path dependent on 
the application. Example:

-- contents of logback.xml shipping within myApp1, one of your web-apps

<configuration scan="true">
   <include file="/a/path/myApp1/logback.xml"/>
</configuration>

Auto scan feature is documented at
   http://logback.qos.ch/manual/configuration.html#autoScan

-- contents of /a/path/myApp1/logback.xml

<included>
   ... other content
</included>

File inclusion is documented at
  http://logback.qos.ch/manual/configuration.html#fileInclusion

Note that logback will scan for changes in included files as well.

HTH,

-- 
QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software developers. For further details, 
see http://logback.qos.ch/job.html


More information about the Logback-user mailing list