Wednesday, 18 September 2013

SLF4J: No Binder, and then Multiple Bindings, trying to Bind to L4J

SLF4J: No Binder, and then Multiple Bindings, trying to Bind to L4J

I have a strange double error with SLF4J.
I'm trying to get SLF4J to bind to L4J.
In Eclipse, when I run a Maven Clean and then a Maven Install, I get this
in the Maven Install output:
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.
Later on, when running the jUnit tests for the project, one of the tests
calls a method that logs a message (I haven't cleaned it up to not log
yet).
But instead of logging, I get this message:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/Users/JDunn/.m2/repository/ch/qos/logback/logback-classic/0.9.30/logback-classic-0.9.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/C:/Users/JDunn/.m2/repository/org/slf4j/slf4j-log4j13/1.0.1/slf4j-log4j13-1.0.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
So it seems that SLF4J first can't load a Binder, and then it finds
multiple Bindings!
In my pom.xml, I have only one relevant dependency:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j13</artifactId>
<version>1.0.1</version>
</dependency>
To resolve the issue, I tried deleting the first binding from my
repository, namely this one:
C:/Users/JDunn/.m2/repository/ch/qos/logback/logback-classic/0.9.30/logback-classic-0.9.30.jar
I ran another Maven Clean, Maven Install and got a strange error when it
tried to run the tests:
Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.14:test (default-test) on
project sonar-score-plugin: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.14:test failed: There was
an error in the forked process
I then ran Maven Clean, Maven Install again, and got the original
"Multiple Bindings" error again, and found that the directory I had
deleted was there again as if I hadn't deleted it.
I don't know what else I can do to get rid of the "Multiple Bindings" error.
Note: I found a similar question, but I don't have the same cause that
could be effecting this error.

No comments:

Post a Comment