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

Ceki Gulcu listid at qos.ch
Thu Oct 30 17:25:32 CET 2008


It looks like netcdf was compiled against nlog4j, which predates SLF4J 1.0. 
Nlog4j is no longer being maintained.

I can see two options:

1) replace nlog4j.jar with vanilla log4j.jar. Then, add the latest slf4j-api.jar 
and slf4j-log4j12.jar (that would be SLF4J 1.5.5) on the class  path. Assuming 
we have done a good job preserving SLF4J backward compatibility, this should work.

2) leave nlog4j.jar. You then need to remove log4j.jar *and* recompile your 
application against nlog4j.jar.

HTH,

Ceki Gulcu wrote:
> 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