Search code examples
javamavenneo4jlogbackslf4j

slf4j fails to bind logger, despite logback existing on classpath


When running integration tests for a project, the following error is logged:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation

According to documentation, this error can only occur when a logger implementation is not on the classpath, however, the following Maven dependencies exist:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>${logback}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>${logback}</version>
    <scope>compile</scope>
</dependency>

Furthermore, when Neo4j 2.x is on the classpath, the problem does not occur, however with Neo4j 3.x it does.

How can I resolve this issue?


Solution

  • I had the same issue. You can try to find all Logback dependencies on your classpath and remove/shade all of them, which are duplicated.

    And look at this link, maybe it will help: http://www.slf4j.org/codes.html#StaticLoggerBinder

    Maven shade plugin