Skip to content

Commit

Permalink
Use Graal friendly logging factory implementations
Browse files Browse the repository at this point in the history
Update `LoggingSystemFactory` class present checks to use a static
final field so that they work better with Graal.

Closes gh-23985
  • Loading branch information
philwebb committed Nov 1, 2020
1 parent 298880c commit fb59432
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Expand Up @@ -187,9 +187,12 @@ public void run() {
@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;
Expand Down
Expand Up @@ -335,9 +335,12 @@ public void run() {
@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;
Expand Down
Expand Up @@ -339,9 +339,12 @@ public void run() {
@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;
Expand Down

0 comments on commit fb59432

Please sign in to comment.