[slf4j-user] slf4j and log4j - log4j exclusion question

Adrian Mocanu amocanu at verticalscope.com
Fri May 9 21:36:00 CEST 2014


I have a few projects that use log4jOverSlf4j and other that use slf4j-log4j so I'm getting a circular loop.

I have this dependency tree in my spark-core jar and I want to remove the lines marked with <------------------------------

[info]   +-org.apache.spark:spark-core_2.10:0.9.1 [S]
[info]   | +-org.apache.zookeeper:zookeeper:3.4.5
[info]   | | +-jline:jline:0.9.94
[info]   | | | +-junit:junit:3.8.1 (evicted by: 4.11)
[info]   | | | +-junit:junit:4.11
[info]   | | |   +-org.hamcrest:hamcrest-core:1.3
[info]   | | |   
[info]   | | +-log4j:log4j:1.2.17   <------------------------------
[info]   | | +-org.jboss.netty:netty:3.2.2.Final
[info]   | | +-org.slf4j:slf4j-api:1.7.2 (evicted by: 1.7.5)
[info]   | | +-org.slf4j:slf4j-api:1.7.5
[info]   | | +-org.slf4j:slf4j-log4j12:1.7.2   <------------------------------
[info]   | |   +-log4j:log4j:1.2.17
[info]   | |   +-org.slf4j:slf4j-api:1.7.2 (evicted by: 1.7.5)
[info]   | |   +-org.slf4j:slf4j-api:1.7.5
[info]   | |   
[info]   | +-org.scala-lang:scala-library:2.10.3 (evicted by: 2.10.4)
[info]   | +-org.slf4j:slf4j-api:1.7.2 (evicted by: 1.7.5)
[info]   | +-org.slf4j:slf4j-api:1.7.5
[info]   | +-org.slf4j:slf4j-log4j12:1.7.2  <------------------------------
[info]   | | +-log4j:log4j:1.2.17
[info]   | | +-org.slf4j:slf4j-api:1.7.2 (evicted by: 1.7.5)
[info]   | | +-org.slf4j:slf4j-api:1.7.5
[info]   | |


In sbt I used exclusion rule (http://www.scala-sbt.org/0.12.2/api/sbt/ExclusionRule.html) like this to get rid of the log4j line and it worked:
val spark="org.apache.spark" % "spark-core_2.10" % "0.9.1" excludeAll(
    ExclusionRule(name = "log4j"),
    ExclusionRule(name = "org.slf4j")
)

I still have org.slf4j:slf4j-log4j12:1.7.2  lines and I can't figure out how to get rid of them.
I tried exluding everything I can think of and to no avail:

    ExclusionRule("org.slf4j"),
    ExclusionRule("org.apache.zookeeper", "log4j"),
    ExclusionRule("org.apache.zookeeper", "org.slf4j"),
    ExclusionRule("org.apache.zookeeper", "org.slf4j","slf4j-log4j12"),
    ExclusionRule("org.apache.zookeeper", "org.slf4j","*"),
    ExclusionRule("org.slf4j", "*", "*"),
    ExclusionRule("org.slf4j","*"),
    ExclusionRule("*","org.slf4j"),
    ExclusionRule("*","*","org.slf4j"),
    ExclusionRule("org.slf4j","slf4j-log4j12")


More information about the slf4j-user mailing list