2014-06-12 107 views
0

我有一些模塊的項目。在父母我已經定義:無法在項目中找到StaticLoggerBinder

org.apache.logging.log4j 的log4j-SLF4J-IMPL $ {} version.log4j運行

但是當我要部署的應用程序,然後StaticLoggerBinder未找到:

No org.slf4j.impl.StaticLoggerBinder found in ClassPath, trying with log4j... 

,但是當我添加depenedcy剛剛到這個項目

<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-log4j12</artifactId> 
<version>${version.log4j}</version> 
</dependency> 

然後2 StaticLoggerBinder成立:

SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/home/hudect/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/home/hudect/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.0-rc1/log4j-slf4j-impl-2.0-rc1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 

,你可以看到第二個是從我的父項目。我真的很困惑,爲什麼會發生這種情況。有人能解釋我應該怎樣修復它?

回答

0

你是否也有log4j-core和log4j-api依賴關係?