This commit is contained in:
Phillip Webb 2021-06-10 00:21:21 -07:00
parent 28abcf88a0
commit 2835085ffb
3 changed files with 4 additions and 31 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -164,7 +164,7 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> LogManager.getLogManager().reset();
}
@Override
@ -172,15 +172,6 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
this.configuredLoggers.clear();
}
private static final class ShutdownHandler implements Runnable {
@Override
public void run() {
LogManager.getLogManager().reset();
}
}
/**
* {@link LoggingSystemFactory} that returns {@link JavaLoggingSystem} if possible.
*/

View File

@ -301,7 +301,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> getLoggerContext().stop();
}
@Override
@ -341,15 +341,6 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
loggerContext.setExternalContext(null);
}
private final class ShutdownHandler implements Runnable {
@Override
public void run() {
getLoggerContext().stop();
}
}
/**
* {@link LoggingSystemFactory} that returns {@link Log4J2LoggingSystem} if possible.
*/

View File

@ -281,7 +281,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> getLoggerContext().stop();
}
private ch.qos.logback.classic.Logger getLogger(String name) {
@ -328,15 +328,6 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
loggerContext.removeObject(LoggingSystem.class.getName());
}
private final class ShutdownHandler implements Runnable {
@Override
public void run() {
getLoggerContext().stop();
}
}
/**
* {@link LoggingSystemFactory} that returns {@link LogbackLoggingSystem} if possible.
*/