Suzan Cioc
Suzan Cioc

Reputation: 30097

logback.xml is ignored in normal Java project

Apparently, no logging occurred in my Java project. logback.xml file is located in the classpath but apparantly ignored. No any errors about this file are reported.

JAR is attached following way (with maven):

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>

The following messages appear in console:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:MYREPO/org/slf4j/slf4j-simple/1.7.5/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:MYREPO/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]

Apparently, both jars are referred by single maven entry.

Upvotes: 1

Views: 1554

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 279880

You seem to have

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.5</version>
</dependency>

Get rid of it. logback already provides the classes you need.

Upvotes: 5

Related Questions