In my application there is a binding of two log files (org/slf4j/impl/StaticLoggerBinder.class
). See below:
SLF4J: Found binding in [jar:file:/C:/Users/n12017/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/n12017/.m2/repository/cosine-lsh/cosinelsh/1.0/cosinelsh-1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Here what I have tried to remove the logback from classpath:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<exclusions>
<exclusion>
<groupId>logback-classic</groupId>
<artifactId>ch.qos.logback</artifactId>
</exclusion>
</exclusions>
</dependency>
I have also tried to exclude from related dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
However, I have failed. How can I remove the logback?
Here is the related part in the dependency tree:
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.1.RELEASE:compile
[INFO] | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.11:compile
[INFO] | | \- org.apache.tomcat:tomcat-juli:jar:8.5.11:compile
[INFO] | \- org.springframework:spring-jdbc:jar:4.3.6.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.3.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:4.2.1.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-core:jar:4.2.1.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:4.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-web:jar:1.5.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.1.RELEASE:compile
[INFO] | | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] | | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] | | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] | | +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] | | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] | | \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] | +- org.thymeleaf:thymeleaf-spring4:jar:2.1.5.RELEASE:compile
[INFO] | \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile
[INFO] | \- org.codehaus.groovy:groovy:jar:2.4.7:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.1.RELEASE:compile
[INFO] | +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] | | \- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] | \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
Thanks in advance.
You've got the groupId
and artifactId
the wrong way around. The exclusion should be:
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
Rather than just excluding logback-classic
, you may want to exclude spring-boot-starter-logging
instead:
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
This will ensure that various other Logback- and SLF4J-related dependencies that the starter also depends upon are not included.