有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java未能在项目中找到StaticLoggerBinder

我有一些模块的项目。在parent中,我定义了:

组织。阿帕奇。登录中。log4j log4j-slf4j-impl ${version.log4j} 运行时

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

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

但当我在这个项目中加入依赖性

<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) 个答案

  1. # 1 楼答案

    您是否也有log4j核心和log4j api依赖项