2014-06-12 75 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依赖关系?