Frequently Asked Questions
Logback project
Logback Classic
- Are logback loggers serializable?
- How does the automatic configuration work?
- How can Jetty be instructed to use logback-classic as its logging implementataion?
Logback project
- Why is logback distributed under LGPL and not the Apache Software License?
-
The logback project is distributed under the LGPL license in order to emphasize the fact that it is a related but different project than log4j.
Given that Java v7 will be distributed under GPL, we expect GPL and LGPL to become even more prevalent in the Java world.
In short, LGPL is a reasonable and widely-accepted license. Let well alone.
Logback-classic
- How does the automatic configuration work?
-
This question is answered in the relevant section of the logback manual.
- Are logback loggers serializable?
-
Yes. A logback logger is an SLF4J logger and SLF4J loggers are serializable. This means that an object referencing a logger will be alble to log after its deserialization.
The deserialized logger instance will be generated by
org.slf4j.LoggerFactory
. Thus, it is possible for a logback logger to be deserialized as a log4j or j.u.l. logger, depending on the deserialization environment. - How can Jetty be instructed to use logback-classic as its logging implementataion?
-
The Jetty application server uses SLF4J for its internal logging.
The following jar files must be present in the JETTY_HOME/lib directory.
Logback-classic is based on the SLF4J api. Therefore, the slf4j-api-VERSION.jar jar must be present. This jar can be downloaded from the SLF4J project.
Logback's own jars must also be present, namely logback-core-VERSION.jar and logback-classic-VERSION.jar .
To configure logback-classic, a file called logback.xml should be placed in the JETTY_HOME/resources directory. You can find sample configuration files in the logback-examples/src/main/java/chapter4/conf/ folder shipping within the logback distribution.