[slf4j-user] Trying to use log4j-over-slf4j
Raymond Cramer
rnc at bodc.ac.uk
Thu Oct 30 17:42:15 CET 2008
I can see in the toolsUI-2.2.22.jar, which is netcdf with all the trimming, that they have an org/slf4j/impl branch with NLOG4J, NOP, and SimpleLoggerFactories if thats what you mean. There is no log4jLoggerFactory.
But I don't have or use nlog4j.jar, so can't apply 1). I could try 2) but that would mean all my packages have to use nlog4j doesn't it. Whilst there are only four, they are used by other apps. But I'll have a go with nlog4j and see if the error message is cleared.
Cheers
Ray
>>> listid at qos.ch 30/10/2008 16:25 >>>
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
_______________________________________________
user mailing list
user at slf4j.org
http://www.slf4j.org/mailman/listinfo/user
--
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.
More information about the slf4j-user
mailing list