无法在项目中找到StaticLoggerBinder

时间:2014-06-12 13:10:30

标签: java log4j2

我有一些模块的项目。在父母我已定义:

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

但是当我想部署应用程序时,找不到StaticLoggerBinder:

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

但是当我在这个项目中添加了essenedcy时

<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]

你可以看到第二个来自我的父项目。我真的很困惑为什么会这样。有人可以解释一下我该如何解决它?

1 个答案:

答案 0 :(得分:0)

您是否还有log4j-core和log4j-api依赖项?