A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© SOAR 中级黑马   /  2013-5-16 12:58  /  3024 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

这几天在学spring,看到它的文档上关于日志那一节是这样说的。
Not Using Commons Logging
Unfortunately, the runtime discovery algorithm in commons-logging, while convenient for the enduser,
is problematic. If we could turn back the clock and start Spring now as a new project it would use
a different logging dependency. The first choice would probably be the Simple Logging Facade for Java
(SLF4J), which is also used by a lot of other tools that people use with Spring inside their applications.
Switching off commons-logging is easy: just make sure it isn't on the classpath at runtime. In Maven
terms you exclude the dependency, and because of the way that the Spring dependencies are declared,you only have to do that once.

大概就是说推荐使用slf4j和配置slf4j的方法,它说为了将commons-logging 移除去很简单,只要把相应的jar包移除去就行了。我将commons-logging .jar移除了,然后把slf4j-api.jar和slf4j-nop.jar加入到了classpath中,但是现在运行时直接报错。我又把commons-logging.jar加入到了classpath中,现在slf4j好像才能工作。难道commons-logging和slf4j还有依赖吗。

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马