-
Notifications
You must be signed in to change notification settings - Fork 302
Slf4j Misuse #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The reason why we have the SLF4J-StaticLoggerBinder in the jar is because Maven screwed up the class loading. See #198 and https://issues.apache.org/jira/browse/MNG-5787 What version of Maven you are using? |
SLF4J: Class path contains multiple SLF4J bindings. |
Maven version is 2.2.1 |
#233 might solve this by removing SLF4J altogether. |
This is solved by the linked PRs, thanks! |
Why does your jar have a StaticLoggerBinder in it?
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hugballs/.m2/repository/pl/project13/maven/git-commit-id-plugin/2.2.0/git-commit-id-plugin-2.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hugeballs/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.4.1/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
http://www.slf4j.org/codes.html#multiple_bindings
Note The warning emitted by SLF4J is just that, a warning. Even when multiple bindings are present, SLF4J will pick one logging framework/implementation and bind with it. The way SLF4J picks a binding is determined by the JVM and for all practical purposes should be considered random. As of version 1.6.6, SLF4J will name the framework/implementation class it is actually bound to.
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. When you come across an embedded component declaring a compile-time dependency on any SLF4J binding, please take the time to contact the authors of said component/library and kindly ask them to mend their ways.
The text was updated successfully, but these errors were encountered: