javaslf4j

How to stop slf4j printing a pointless information message at startup?


I'm not using SLF4J myself, but some Apache library that I'm using has it as a dependency. (I've installed the latest version: 2.1.0-alpha1).

I have added the corresponding slf4j-nop library on my classpath, and now instead of complaining that there's no SLF4J implementation, it prints to STDERR the following message:

SLF4J(I): Connected with provider of type [org.slf4j.nop.NOPServiceProvider]

It's an information message saying it's found my NOP provider. How can I get rid of this pointlessly irritating message? I did a Google search for the message but came up with no hits.

I would prefer not to redirect STDERR or anything weird like that if I can help it. Surely, there must be a built-in way to stop this message from printing?


Solution

  • OK, so I ended up reading the slf4j source code, and it turns out you can turn off this message by setting the slf4j.internal.verbosity system property to WARN.

    I just put this at the start of my main method:

    System.setProperty("slf4j.internal.verbosity", "WARN");