[slf4j-user] trouble migrating from log4j 1.2 to log4j 2.0

niels opensource21 at gmail.com
Tue Jul 29 07:28:13 CEST 2014


Hi,

just an idea:
slf4j-log4j12-1.7.7.jar sounds like a binding for log4j 1.2 not for log4j
2.0. So I would guess it's a wrong binding. No idea if there exists a 2.0
Binding. See http://logging.apache.org/log4j/2.x/log4j-slf4j-impl/

Regards
Niels


2014-07-28 20:53 GMT+02:00 Mike Wertheim <mikew at hyperreal.org>:

> Hi,
>
> I am trying to migrate my app from log4j 1.2 to log4j 2.0.  My app uses
> log4j directly, and it also uses a third party library that uses slf4j.
>
> I put following jar files in my Classpath:
> log4j-api-2.0.jar, log4j-core-2.0.jar
> slf4j-api-1.7.7.jar, slf4j-log4j12-1.7.7.jar
>
> When I try to start my app, the third party library's use of slf4j causes
> this exception to be thrown:
>
> java.lang.NoClassDefFoundError: org/apache/log4j/Level
>     at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
>     at
> org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
>     at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
>
> This is not surprising, since the log4j 2.0 migration page (
> http://logging.apache.org/log4j/2.x/manual/migration.html) says: "The
> main package in version 1 is org.apache.log4j, in version 2.0 it is
> org.apache.logging.log4j"
>
> Am I correct that the slf4j developers will need to make some
> modifications to slf4j to enable compatibility with log4j 2.0
> (specifically, changing slf4j to look for the log4j classes in
> org.apache.logging.log4j rather than org.apache.log4j)?
>
> Or is there some workaround to this issue that I can do now?
>
>
> Thanks,
> Mike
>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20140729/e6d5889f/attachment.html>


More information about the slf4j-user mailing list