apache-log4j-extras also declares `Appender` inter

2019-07-25 11:38发布

问题:

My classpath, as generated by Gradle, includes both apache-log4j-extras-1.2.17.jar, and log4j-1.2.17.jar. I believe these were both downloaded from Maven Central. In any case, in files I have in front of me, all the class and interface definitions from the log4j jar in the org.apache.log4j package are duplicated in the "extras" jar. When log4j is initialized, there's a class-loading conflict:

java.lang.ClassCastException: org.apache.log4j.rolling.RollingFileAppender cannot be cast to org.apache.log4j.Appender

What's the easiest thing to do here? Simply build and publish the JAR of "extras" to my company's Ivy server? I don't know why you'd redeclare the Appender interface.