Slf4j: any way to suppress a NOP error message?

If I use slf4j and the classpath does not contain a log implementation, it by default performs the NOP registration operation. This is good with me. But is there a 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. 
+4
source share
1 answer

There are several ways and workarounds:

  • Add inline slf4j-nop binding to your CLASSPATH
  • Create your own binding that really does nothing. More work, less hacks.
  • Override System.err by calling System.setErr() with some null implementation of PrintStream
+4
source

All Articles