gpt4 book ai didi

java - 加载类 'org.slf4j.impl.StaticLoggerBinder' 失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:52:09 26 4
gpt4 key购买 nike

我创建了一个包含所有依赖项的 jar 文件,并使用 slf4j + logback 实现了日志记录。因此,我为所有记录器定义了一个 logback.xml 文件。但是,当我运行 jar 时,它给了我这条消息:

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.

我没有看到任何日志记录发生。解压 jar 文件后,我可以看到 org.slf4j 文件夹。我不知道为什么这不起作用。

最佳答案

来自 http://www.slf4j.org/codes.html#StaticLoggerBinder (消息中的链接):

This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem. SINCE 1.6.0 As of SLF4J version 1.6, in the absence of a binding, SLF4J will default to a no-operation (NOP) logger implementation. You can download SLF4J bindings from the project download page.

换句话说,您的类路径中需要一个 slf4j 后端,例如回退。

关于java - 加载类 'org.slf4j.impl.StaticLoggerBinder' 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13131365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com