这几天在学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还有依赖吗。 |
|