I have an existing application that does all its logging with log4j. We use a number of other libraries that either use log4j or are logged in Commons Logging, which ends up using log4j under covers in our environment. One of our dependencies even writes messages to slf4j, which also works fine, as it ultimately delegates log4j as well.
Now I would like to add ehcache to this application for some caching needs. Previous versions of ehcache used commons-logging, which would work fine in this scenario, but with version 1.6-beta1 they removed the dependency on commons-logging and replaced java.util.logging instead.
Not familiar with the built-in JDK log, accessible via java.util.logging, is there an easy way to have any log messages sent by JUL logged against log4j, so I can use the existing configuration and configure any log coming from ehcache?
Looking at the javadocs for the JUL, it looks like I can set up a group of environment variables to modify the LogManager implementation LogManager and possibly use it to port log4j Logger to the JUL Logger class. Is this the right approach?
The irony is that using the JDK built-in journaling library can cause such a headache when (in most cases) the rest of the world uses third-party libraries.
java apache-commons logging slf4j log4j
matt b May 15 '09 at 17:31 2009-05-15 17:31
source share