in src/main/java/org/apache/commons/logging/LogFactory.java [1411:1440]
private static LogFactory newStandardFactory(final ClassLoader classLoader) {
if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, classLoader)) {
try {
return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
} catch (final LinkageError | ReflectiveOperationException ignored) {
} finally {
logDiagnostic(() ->
"[LOOKUP] Log4j API to SLF4J redirection detected. Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
}
}
try {
return (LogFactory) Class.forName(FACTORY_LOG4J_API, true, classLoader).getConstructor().newInstance();
} catch (final LinkageError | ReflectiveOperationException ignored) {
} finally {
logDiagnostic(() -> "[LOOKUP] Loading the Log4j API LogFactory implementation '" + FACTORY_LOG4J_API + "'.");
}
try {
return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
} catch (final LinkageError | ReflectiveOperationException ignored) {
} finally {
logDiagnostic(() -> "[LOOKUP] Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
}
try {
return (LogFactory) Class.forName(FACTORY_DEFAULT, true, classLoader).getConstructor().newInstance();
} catch (final LinkageError | ReflectiveOperationException ignored) {
} finally {
logDiagnostic(() -> "[LOOKUP] Loading the legacy LogFactory implementation '" + FACTORY_DEFAULT + "'.");
}
return null;
}