[logback-user] configuration: Joran vs logback.xml

Sebastien Pennec sebastien at qos.ch
Thu Jan 18 13:57:55 CET 2007


Hello Deirdre,

For most situtations, placing a file called logback.xml in your classpath and letting 
logback load it is the best approach. That way, your application will only use 
logback and not configure it. All configuration aspects will be in the logback.xml file.

However, Joran allows the user to feed it with any file, whether or not it is called 
logback.xml, and whether or not it is in the classpath. It is a flexibility that 
Joran offers which comes handy sometimes.

Unless your application cannot use a simple logback.xml file placed somewhere in the 
classpath, you should just use the default configuration policy and let logback load 
its configuration file.

Hope this helps,

Sébastien

Deirdre wrote:
> Hi,
> 
> I'm a new user of logging and have decided to start of with logback.  I have a
> question regarding the configuration file: 
> 
> The manual states:
> "When logback is not configured by instanciating JoranConfigurator objects, it
> follows a simple policy to configure itself.  Logback first tries to find a file
> called logback.xml within the classpath."
> 
> Why then bother instanciating JoranConfigurator objects and asking that the
> configurator parse a certain configuration file 'sample.xml'.  Why not just save
> the file as 'logback.xml' and it will be automatically read and parsed as the
> configuration file, without the use of JoranConfigurator objects, or?
> 
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 

-- 
Sébastien Pennec
sebastien at qos.ch

Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch/



More information about the Logback-user mailing list