Tomcat + SLF4J + Logback

Tired of using Tomcat and having problems with logging? grgrzybek user just made a project on GitHub called tomcat-slf4j-logback:

This project’s main and only goal is to allow the following:

redirect all org.apache.commons.logging (repackaged to org.apache.juli.logging) calls to org.slf4j (repackaged to – i.e. handle internal tomcat logging with slf4j and logback binding,
make still possible to use logback-access with logback-access.xml config – using standard functionality of logback-access,
make possible to use independent configuration of slf4j+logback from all web applications which may carry their own slf4j-api, logback-core and logback-classic in their WEB-INF/lib directory.

Using only ANT’s build.xml file (based on the file provided with Tomcat), proper source JARs are downloaded from maven repository and unpacked. Then all classes are refactored under org.apache.juli.logging package, subpackages and then compiled.

The project is currently migrating from ant build to a mavenized one, you can help out by testing it:

The current ant/ivy build will soon be replaced with a maven build. A maven branch currently exists and is ready for user feedback. The build time is rather quick. One major change will be occurring with this. Currently this project requires 4 jars to be placed into tomcat/bin directory. Once the maven build is merged into master, it will simply contain a single shaded jar file for tomcat-juli containing all that everyone is familiar with. No other changes are necessary.

Additionally, sourceforge builds have not been updated recently. Grzegorz has been quite busy and I have picked up building out this conversion to maven. We hope to have this resolved shortly. In the meantime, feel free to pull down the maven branch and give it a try.

Additionally, as it has been raised multiple times, there are no current plans to move this to maven central. However, that might be an option for those that want to run embedded tomcat. This will be determined at a later time.

It’s a huge effort for a a single person, so let’s gather and help it.

Leave A Comment

Your email address will not be published. Required fields are marked *