今天上午无聊逛了下Spring的官网,在Spring官方文档的时候发现有这么一条 Not Using Commons Logging
Unfortunately, the runtime discovery algorithm in commons-logging, while convenient for the end-user, is problematic.
Using SLF4J
SLF4J is a cleaner dependency and more efficient at runtime than commons-logging because it uses compile-time bindings instead of runtime discovery of the other logging frameworks it integrates.
SLF4J是一个更清洁和更有效的在运行时的依赖比commons-logging由于它使用编译时绑定,而不是运行时发现的其他日志记录框架集。
Using Log4J
Many people use Log4j as a logging framework for configuration and management purposes.It’s efficient and well-established
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.5.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
之前一直在看百度搜的各种文章,其实官方的第一手资料才是最好的,强化一下英语,坚持看第一手资料,共勉!