【问题标题】:I am not using slf4j in my code but still I am getting warnings related to it我没有在我的代码中使用 slf4j,但我仍然收到与之相关的警告
【发布时间】:2021-01-12 10:54:13
【问题描述】:

我正在使用 log4j,但在运行我的应用程序时收到 slf4j 警告:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

我正在使用这些依赖项:

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
    </dependency>

请帮助我在启动应用程序时消除这些警告。

【问题讨论】:

  • 你的代码有没有引用SLF4J?
  • 我猜:停止使用那些依赖项,那些警告就会消失。他们不会伤害,他们只是通知,让他们去吧。
  • @TimBiegeleisen 不,我没有
  • @Eritrean,非常感谢,它对我有用。我想知道为什么我一开始就无法获得此链接。

标签: java spring-boot log4j slf4j


【解决方案1】:

如果它是一个 maven 项目,您可以首先从 pom.xml 中删除这些依赖项。 然后在 pom.xml 目录下运行

maven clean compile

之后,您可以再试一次。

【讨论】:

    【解决方案2】:

    可能是因为你的项目中有一些第三方库,你可以在依赖树中找到它的依赖并将它从你的项目中排除。

    【讨论】:

      猜你喜欢
      • 2021-01-02
      • 2017-10-28
      • 1970-01-01
      • 1970-01-01
      • 2012-02-22
      • 2015-04-18
      • 2015-01-17
      • 2015-01-30
      • 1970-01-01
      相关资源
      最近更新 更多