[slf4j-user] Trying to use log4j-over-slf4j

Ceki Gulcu listid at qos.ch
Thu Oct 30 17:12:34 CET 2008


Hello Raymond,

Raymond Cramer wrote:

 > I'm new to slf4j, having been using log4j. I am trying to use a
 > package (netcdf) that requires slf4j, but am having problems getting
 > my head around some of this stuff.
 >
 > 1) If I have an application (which uses log4j) deployed through
 > Tomcat, do I simply replace the log4j jar file with log4j-over-slf4j
 > and slf4j-api jar files? Because when I do this the application
 > doesn't run at all- I get the HTTP Status 404 error that my JSP can't
 > be found.

You would replace log4j.jar only if you wish to use a different logging 
implementation, say java.util.logging or logback. If you wish to stick with 
log4j, then stick to log4j.jar.

 > If I put the log4j jar back the app works (having restarted Tomcat),
 > but I think its using log4j not slf4j because I eventually get the
 > error
 >
 > java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger
 > does not implement the requested interface org.slf4j.Logger

That's strange. Have you placed slf4j-api.jar and slf4j-log4j12.jar on the class 
path? If you have, which versions are you using?


-- 
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