Commit fb59432c authored by Phillip Webb's avatar Phillip Webb

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
parent 298880c2
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment