问题
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.
来源:https://stackoverflow.com/questions/40029109/apache-log4j-extras-also-declares-appender-interface