gpt4 book ai didi

java - SLF4J : Failed to load class "org.slf4j.impl.StaticLoggerBinder". Java应用程序错误

转载 作者:行者123 更新时间:2023-12-01 11:44:49 34 4
gpt4 key购买 nike

我正在使用 Java 编写服务器端套接字应用程序,但我不知道什么会导致此错误

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.

如何解决这个问题?

最佳答案

您收到此消息是因为 slf4j 在您的类路径中找不到绑定(bind)。 slf4j 就像其他日志框架的包装器。它需要您打算使用的日志框架的绑定(bind)库来实际记录消息。例如,要使用 log4j,请添加库 slf4j-log4j12.jar 和 log4j.jar。更多详细信息可以在 SLF4J 手册中找到:http://www.slf4j.org/manual.html .

To switch logging frameworks, just replace slf4j bindings on yourclass path. For example, to switch from java.util.logging to log4j,just replace slf4j-jdk14-1.7.10.jar with slf4j-log4j12-1.7.10.jar.

SLF4J does not rely on any special class loader machinery. In fact,each SLF4J binding is hardwired at compile time to use one and onlyone specific logging framework. For example, theslf4j-log4j12-1.7.10.jar binding is bound at compile time to uselog4j. In your code, in addition to slf4j-api-1.7.10.jar, you simplydrop one and only one binding of your choice onto the appropriateclass path location. Do not place more than one binding on your classpath.

关于java - SLF4J : Failed to load class "org.slf4j.impl.StaticLoggerBinder". Java应用程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29236093/

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