qos-ch/slf4j

Provide mechanism to squelch provider warnings at startup

robertpatrick opened this issue · 2 comments

We have software that uses a couple of different technologies. One is an application that includes the nop jar that our application builds on top of. We have no ability to change the underlying application. We also use sshj as an SSH client that uses SLF4J to log. In order to capture the logs generated by sshj, we include a provider in the classpath. Now, at startup. we see the following warnings in stdout:

SLF4J(W): Class path contains multiple SLF4J providers.
SLF4J(W): Found provider [org.slf4j.jul.JULServiceProvider@704ca8a8]
SLF4J(W): Found provider [org.slf4j.nop.NOPServiceProvider@61c98f5]
SLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J(I): Actual provider is of type [org.slf4j.jul.JULServiceProvider@704ca8a8]

I need a way to suppress this output.

ceki commented

@robertpatrick Regarding the supression of internal messages see faq entry.

Regarding the choice of the provider, since version 2.0.9, you can specify the provider class explicitly via the "slf4j.provider" system property. This bypasses the service loader mechanism for finding providers and may shorten SLF4J initialization. For a list of providers class names, see the relevant FAQ entry.

ceki commented

I am marking this issue as done. Let me know if you have further questions.