
That won't really work since both programs use the same jar. I really need the ability to specify which jar-packaged config file to use from the command line. The documentation implies that this is possible, I just would like to know how. On 10/29/2012 06:43 AM, Thorbjørn Ravn Andersen wrote:
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?
-----Original Message----- From: logback-user-bounces@qos.ch [mailto:logback-user-bounces@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, http://logback.qos.ch/manual/configuration.html#configFileProperty, there is the following section
Specifying the location of the default configuration file as a system property
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 chapters.configuration.MyApp1
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 work.
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@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user