[slf4j-user] using log4j-over-slf4j with jetty 6

Ceki Gülcü listid at qos.ch
Wed Nov 22 22:02:41 CET 2006


Hello Michael,

You seem to want to direct SLF4J calls (made by jetty) to log4j. Thus, is 
log4j is your logging system of choice, you should place slf4j-log4j12.jar 
on the class path *not* log4j-over-slf4j-1.1.0-RC1.jar. The latter file 
(log4j-over-slf4j-1.1.0-RC1.jar) is intended to redirect log4j API calls to 
SLF4J, and then let SLF4J redirect to another logging system.

I hope this helps,

At 02:53 AM 11/22/2006, Michael Flester wrote:
>Hi --
>
>An existing project of mine uses log4j. This project
>also embeds a Jetty server. In trying to upgrade
>from Jetty 5 to Jetty 6 all of the Jetty logging
>started going to stdout and Jetty says it will do
>something different if it finds an slf4j.Logger on
>the classpath.
>
>Ok, so I found slf4j-api-1.1.0-RC1.jar and
>log4j-over-slf4j-1.1.0-RC1.jar, and put them on
>my classpath, removing the former log4j-1.2.14.jar .
>Looks like a great idea.
>
>I haven't gotten as far as figuring out whether
>Jetty understands this as some things that
>I was using in log4j do not seem implemented
>in the log4j-over-slf4j classes.
>
>Namely --
>
>org.apache.log4j.Logger
>                                    .setLevel(Level)
>                                    .getLevel(Level)
>                                    .isEnabledFor(Level)
>                                    .log(Level,Object)
>                                    .log(Level,Object,Throwable)
>
>Other things I need are missing, like org.apache.log4j.Level
>but by putting the old log4j log file on the classpath after
>the slf4j I get past that but not
>the missing methods on Logger. Is using the log4j.jar file
>in addition to the two slf4j jar files the way to go about this?
>
>Reading the list archive, I sense some of this may be
>by design, but I'm not sure. Can someone clarify
>if I am doing this right?
>
>How would you integrate Jetty 6 and it's new slf4j
>requirement into an existing log4j enabled project
>using slf4j?
>
>Thanks,
>Mike

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list