Slf4j: Difference between revisions
No edit summary |
|||
Line 5: | Line 5: | ||
=Bindings= | =Bindings= | ||
=Log4J Binding= | ==Log4J Binding== | ||
=Troubleshooting= | =Troubleshooting= |
Revision as of 03:41, 2 December 2016
Internal
Bindings
Log4J Binding
Troubleshooting
No StaticLoggerBinder
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 needs an actual binding to a known logging framework. The above message means that the binding, provided by org.slf4j.impl.StaticLoggerBinder, was not found, which means that no appropriate SLF4J binding could be found on the class path.
To fix, you need to place one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the classpath.
If you are packaging an application and you do not care about logging, then placing slf4j-nop.jar on the class path of your application will get rid of this warning message. Note that embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api. When a library declares a compile-time dependency on a SLF4J binding, it imposes that binding on the end-user, thus negating SLF4J's purpose.
Multiple SLF4J Bindings
If the classpath contains two or more JARs with SLF4J bindings, we get this:
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/ovidiu/runtime/os-stats-1.0.1-SNAPSHOT-6/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/ovidiu/runtime/jboss-eap-6.4.6/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-1.0.3.GA-redhat-1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
The solution is to leave only one.
More details: