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

标签 java sockets

我正在使用 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 your class 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 only one specific logging framework. For example, the slf4j-log4j12-1.7.10.jar binding is bound at compile time to use log4j. In your code, in addition to slf4j-api-1.7.10.jar, you simply drop one and only one binding of your choice onto the appropriate class path location. Do not place more than one binding on your class path.

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

相关文章:

java - 从 application.properties : Attribute value must be constant 读取

java控制台字符集翻译

c - unix 域套接字的 tcp_nodelay 设置

silverlight - 根据编程规范计算服务器要求

c++ - 如何在多线程中使用非阻塞套接字?

python - 从套接字 : Is it guaranteed to at least get x bytes? 读取

java - Maven 构建顺序(多个模块)

Java按alphabeta char拆分在数组中创建一个空值

java - 运行 Test.class,但无法加载 ApplicationContext

c++ - 通过 Win32 应用程序从 C/C++ 中的 UDP 端口读取