[logback-user] How to use different xml settings file for logback depending on run.mode

Olek Swirski olekswirski at gmail.com
Thu Sep 20 20:58:51 CEST 2012


Hi,

I'm using logback in a runnable jar containing a lift webapp. logback reads
its settings from logback.xml file at the root of the jar.
This runnable jar can be run in development mode by just using:
java -jar myexecutable.jar
but also in production mode:
java -Drun.mode=production -jar myexecutable.jar
I would like to be able to use different file for logback configuration 
depending on
the run.mode. For example in default (development) mode this could be
default.logback.xml (or just logback.xml as it is by default)
and in production
production.default.logback.xml
or in test
test.default.logback.xml

How do I do that? In my app, there is a runnable object Start, with main 
method,
where I probably could set some init options for logback depending on 
the run mode,
which can be detected with System.getProperty("run.mode").

Here is the topic on lift mailing list, about this executable jar, and 
some last few
messages are about trying to figure this out
https://groups.google.com/forum/?fromgroups=#!topic/liftweb/uwwIA8FwmU8



More information about the Logback-user mailing list