Spring-jclソース(3)--LogAdapterがLogオブジェクトを作成するプロセス
1653 ワード
/* Log4j Logger */
private static final String LOG4J_SPI = "org.apache.logging.log4j.spi.ExtendedLogger";
private static final String LOG4J_SLF4J_PROVIDER = "org.apache.logging.slf4j.SLF4JProvider";
/* , */
private static final String SLF4J_SPI = "org.slf4j.spi.LocationAwareLogger";
/* SLF4J Logger */
private static final String SLF4J_API = "org.slf4j.Logger";
/* LogApi */
private static final LogApi logApi;
static {
/* LOG4J_SPI */
if (isPresent(LOG4J_SPI)) {
/* LOG4J_SLF4J_PROVIDER SLF4J_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.
/* log4j-to-slf4j , slf4j SPI, , log4j slf4j API, 。 */
logApi = LogApi.SLF4J_LAL;
}
else {
// Use Log4j 2.x directly, including location awareness support
/* log4j 2.x, */
logApi = LogApi.LOG4J;
}
}
/* SLF4J_SPI */
else if (isPresent(SLF4J_SPI)) {
// Full SLF4J SPI including location awareness support
/* SLF4J SPI, */
logApi = LogApi.SLF4J_LAL;
}
/* SLF4J_API */
else if (isPresent(SLF4J_API)) {
// Minimal SLF4J API without location awareness support
/* SLF4J API */
logApi = LogApi.SLF4J;
}
else {
// java.util.logging as default
/* java.util.logging logApi */
logApi = LogApi.JUL;
}
}