开发者

slf4j: any way to suppress the NOP error message?

开发者 https://www.devze.com 2023-04-02 08:14 出处:网络
If I use slf4j and the classpat开发者_如何学编程h doesn\'t contain a logger implementation, it defaults to a NOP logger operation. That\'s fine with me. But is there any way to suppress the initial er

If I use slf4j and the classpat开发者_如何学编程h doesn't contain a logger implementation, it defaults to a NOP logger operation. That's fine with me. But is there any way to suppress the initial error message?

 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.


There are several ways and workarounds to achieve this:

  • Add built-in slf4j-nop binding to your CLASSPATH
  • Create your own binding that truly does nothing. More work, less hacky.
  • Override System.err by calling System.setErr() with some null implementation of PrintStream
0

精彩评论

暂无评论...
验证码 换一张
取 消