[logback-user] add property for specifying logback.xmlfilelocation

Ceki Gülcü listid at qos.ch
Thu Feb 8 21:57:36 CET 2007

At 09:11 PM 2/8/2007, Newcomb, Michael-P57487 wrote:
>IMHO, a file that includes other files would not be simpler.
>It seems much simpler to for me to create 3 bat/sh files that do:
>java -Dch.qos.logback.config=foo/bar/logback-trace.xml Foo
>java -Dch.qos.logback.config=foo/bar/logback-debug.xml Foo
>java Foo
>I might be misunderstanding your file inclusion idea.

The file inclusion feature combined with system properties accomplishes the 
same thing as your original request.

Let the contents of "logback.xml" be:

   <include url="${logback-config}"/>

By setting the logback-config system property to a value of your choice, 
you could determine the config file that gets read.

This approach yields the same results as your proposal except that we would 
not need to touch the initialization code. (It's already complicated as it is.)

Does this make better sense?

>Is Joran a part of Logback? If so, it introduces a dependency on Logback, 
>which using slf4j is supposed to alleviate.

Joran ships within logback-core. As such, I couldn't quite parse your 
comment about SLF4J. :-)

>For some background, I am developing a project (www.sf.net/projects/ohla) 
>that has both a library (for clients) and an executable (server).

Best wishes for the ohla project.


Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the Logback-user mailing list