## Frequently Asked Questions

### Logback project

1. Why is logback distributed under LGPL and not the Apache Software License?

### Logback Classic

1. How can I use logback-classic with Jetty ?
2. How does the automatic configuration work?
3. How can I intercept JCL calls in Tomcat?
4. How can I intercept JCL calls in Jetty ?

## 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 can I use logback-classic with Jetty ?

  The Jetty application server uses SLF4J for its internal logging. Here are the required steps to install logback as SLF4J's underlaying implementation.

  A few jars 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 configuration samples in the examples/src/chapter4/conf/ directory, in the distribution of logback.

  [top]

How does the automatic configuration work?

  This question is answered in the relevant section of the logback manual.

  [top]

How can I intercept JCL calls in Tomcat?

  When a dependency of your webapp logs using Jakarta Commons Logging (for example Struts), you can intercept these calls and redirect them to logback.

  This can be done by using jcl104-over-slf4j.jar , a module that is shipped with SLF4J .

  If you have only one webapp, its WEB-INF/lib directory should already contain the logback jars, namely logback-core-VERSION.jar , logback-classic-VERSION.jar and slf4j-api-VERSION.jar . A logback configuration file, named logback.xml should be placed in the WEB-INF/classes/ directory.

  You now need to add `jcl104-over-slf4j.jar` to your WEB-INF/lib directory and remove `commons-logging-1.0.4.jar` . The logging that used to be directed to JCL should now be handled by logback.

  In case several webapps share the logback jars, you might place the previously mentionned jars in the common/lib/ directory of your Tomcat installation. The logback.xml file should then be placed in common/classes .

  [top]

How can I intercept JCL calls in Jetty ?

  Using logback as the logging implementation of choice for frameworks depending on JCL can also be done in Jetty.

  In case you have only one webapp, the required steps are exactly the same as those needed in Tomcat.

  In case several webapps share the logback jars, you might place the necessary jars in the lib/ directory of your Jetty installation. The logback.xml file should then be placed in the resources/ directory.

  However, due to Jetty's internal Classloading mechanism, the logback-classic-VERSION.jar and slf4j-api-VERSION.jar files should also be placed in the WEB-INF/lib/ directory of your webapps.

  [top]