@
tunzao 不是。为了保持兼容,用 JCL 一样的接口,但自己另外实现了。
https://github.com/spring-projects/spring-framework/blob/master/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java其中主要调用 LogAdaptor,看看其源代码就明白了。
https://github.com/spring-projects/spring-framework/blob/master/spring-jcl/src/main/java/org/apache/commons/logging/LogAdapter.javastatic {
if (isPresent(LOG4J_SPI)) {
if (isPresent(LOG4J_SLF4J_PROVIDER) && isPresent(SLF4J_SPI)) {
// log4j-to-slf4j bridge -> we'll rather go with the SLF4J SPI;
// however, we still prefer Log4j over the plain SLF4J API since
// the latter does not have location awareness support.
logApi = LogApi.SLF4J_LAL;
}
else {
// Use Log4j 2.x directly, including location awareness support
logApi = LogApi.LOG4J;
}
}
else if (isPresent(SLF4J_SPI)) {
// Full SLF4J SPI including location awareness support
logApi = LogApi.SLF4J_LAL;
}
else if (isPresent(SLF4J_API)) {
// Minimal SLF4J API without location awareness support
logApi = LogApi.SLF4J;
}
else {
// java.util.logging as default
logApi = LogApi.JUL;
}
}