You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Jukka Zitting <ju...@gmail.com> on 2006/03/12 16:16:42 UTC

SLF4J logging in Jackrabbit

Hi,

A short while ago I changed (r385280) all the Log4J logging statements
in Jackrabbit to use the new SLF4J logging facade
(http://www.slf4j.org/). This allows Jackrabbit log messages to be
easily routed to the logging framework used by the container or
application into which Jackrabbit has been deployed.

I made this change by adding SLF4J Log4J adapter
(slf4j-log4j12-1.0.jar) as a new dependency and changing all
o.a.log4j.Logger references to equivalent SLF4J references. The only
end-user visible effect of this change is that they need to include
the small slf4j-log4j12-1.0.jar library in the Jackrabbit classpath.
No log configuration changes are needed as Log4J remains the default
logging framework. It is possible to change this default by simply
replacing the slf4j-log4j12-1.0.jar with another SLF4J adapter library
in the deployment classpath.

For developers the preferred way to add logging to a class is now the following:

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    class Example {
        private static final Logger logger =
LoggerFactory.getLogger(Example.class);
    }

Note that although the Log4J library remains in the classpath for
backwards compatibility, you should no longer use direct references to
the org.apache.log4j package.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development