今天 log的时候 总是classnotfound common-logging
后来添加了如下的代码就好了。
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.2</version>
</dependency>
如果在原有commons-logging 系统里,如果要迁移到slf4j, 使用slf4j 替换commons-logging ,也是可以做到的。原理使用到了上述commons-logging 加载的第二点。需要引入Org.slf4j.jcl-over-slf4j-1.5.6.jar 。这个jar 包提供了一个桥接,让底层实现是基于slf4j 。原理是在该jar 包里存放了配置META-INF/services/org.apache.commons.logging.LogFactory =org.apache.commons.logging.impl.SLF4JLogFactory ,而commons-logging 在初始化的时候会找到这个serviceId ,并把它作为LogFactory 。
http://www.iteye.com/topic/934593 java日志,需要知道的几件事
就是说要替换调原来的commons-logging .
很开心~~~