Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jun 10, 2021
1 parent 28abcf8 commit 2835085
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -164,23 +164,14 @@ private Level getEffectiveLevel(Logger root) {

@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> LogManager.getLogManager().reset();
}

@Override
public void cleanUp() {
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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private LoggerConfiguration convertLoggerConfig(String name, LoggerConfig logger

@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> getLoggerContext().stop();
}

@Override
Expand Down Expand Up @@ -341,15 +341,6 @@ private void markAsUninitialized(LoggerContext loggerContext) {
loggerContext.setExternalContext(null);
}

private final class ShutdownHandler implements Runnable {

@Override
public void run() {
getLoggerContext().stop();
}

}

/**
* {@link LoggingSystemFactory} that returns {@link Log4J2LoggingSystem} if possible.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void setLogLevel(String loggerName, LogLevel level) {

@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
return () -> getLoggerContext().stop();
}

private ch.qos.logback.classic.Logger getLogger(String name) {
Expand Down Expand Up @@ -328,15 +328,6 @@ private void markAsUninitialized(LoggerContext loggerContext) {
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.
*/
Expand Down

0 comments on commit 2835085

Please sign in to comment.