[logback-user] alternate configuration files on the classpath
Thorbjørn Ravn Andersen
thunderaxiom at hotmail.com
Mon Oct 29 12:43:32 CET 2012
I have not used this system property.
If your application does not include the installer code, but the installer
includes the application code, then you can enclose "logback.xml" with the
main application and "logback-test.xml" in the installer.
Then "logback-test.xml" will be used if present, otherwise "logback.xml".
Perhaps this is useful?
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On
Behalf Of Steve Cohen
Sent: 26. oktober 2012 21:49
To: 'logback users list'
Subject: [logback-user] alternate configuration files on the classpath
In the logback manual,
there is the following section
> Specifying the location of the default configuration file as a system
> If you wish, you can specify the location of the default configuration
file with a system property named logback.configurationFile. The value of
this property can be a URL, a resource on the class path or a path to a file
external to the application.
> java -Dlogback.configurationFile=/path/to/config.xml
There is no example of using this property to refer to a configuration file
on the classpath, for example, an alternate configuration file deployed in
an application jar file. This is my requirement. I have two executables,
the main one, and an auto-installer for it, code for which lives in the same
jar file, with each executable launched by its own batch file.
I tried placing an alternate config file on the root of the classpath inside
the jar file (at the same directory as logback.xml). this does not seem to
What is the correct format for defining -Dlogback.configurationFile= for a
resource located in a jar file on the classpath or, for that matter, any
other classpath resource more generically?
Logback-user mailing list
Logback-user at qos.ch
More information about the Logback-user