In addition to Jatin's answer:
Spring uses Jakarta Commons Logging as a logging API. In order to log to slf4j, you need to make sure commons-logging
is not on the classpath. jcl-over-slf4j
is a replacement jar for commons-logging.
If you're using maven, you can detect where commons-logging comes from using mvn dependency:tree
and exclude it from all dependencies that require it using dependency exclusions. You might need to run mvn dependency:tree
several times though, because it only shows the first occurence of a transitive dependency.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…