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

Mike Wertheim mikew at hyperreal.org
Mon Jul 28 20:53:02 CEST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20140728/67fe0a80/attachment.html>


More information about the slf4j-user mailing list