Use Graal friendly logging factory implementations

Update `LoggingSystemFactory` class present checks to use a static
final field so that they work better with Graal.

Closes gh-23985
pull/23999/head
Phillip Webb 4 years ago
parent 298880c260
commit fb59432cf5

@ -187,9 +187,12 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
@Order(Ordered.LOWEST_PRECEDENCE)
public static class Factory implements LoggingSystemFactory {
private static final boolean PRESENT = ClassUtils.isPresent("java.util.logging.LogManager",
Factory.class.getClassLoader());
@Override
public LoggingSystem getLoggingSystem(ClassLoader classLoader) {
if (ClassUtils.isPresent("java.util.logging.LogManager", classLoader)) {
if (PRESENT) {
return new JavaLoggingSystem(classLoader);
}
return null;

@ -335,9 +335,12 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
@Order(Ordered.LOWEST_PRECEDENCE)
public static class Factory implements LoggingSystemFactory {
private static final boolean PRESENT = ClassUtils
.isPresent("org.apache.logging.log4j.core.impl.Log4jContextFactory", Factory.class.getClassLoader());
@Override
public LoggingSystem getLoggingSystem(ClassLoader classLoader) {
if (ClassUtils.isPresent("org.apache.logging.log4j.core.impl.Log4jContextFactory", classLoader)) {
if (PRESENT) {
return new Log4J2LoggingSystem(classLoader);
}
return null;

@ -339,9 +339,12 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
@Order(Ordered.LOWEST_PRECEDENCE)
public static class Factory implements LoggingSystemFactory {
private static final boolean PRESENT = ClassUtils.isPresent("ch.qos.logback.core.Appender",
Factory.class.getClassLoader());
@Override
public LoggingSystem getLoggingSystem(ClassLoader classLoader) {
if (ClassUtils.isPresent("ch.qos.logback.core.Appender", classLoader)) {
if (PRESENT) {
return new LogbackLoggingSystem(classLoader);
}
return null;

Loading…
Cancel
Save