Merge branch '2.1.x'

Closes gh-17470
pull/17471/head
Andy Wilkinson 5 years ago
commit be3a737532

@ -21,6 +21,7 @@ import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
@ -51,6 +52,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
private static final LogLevels<Level> LEVELS = new LogLevels<>(); private static final LogLevels<Level> LEVELS = new LogLevels<>();
private final Set<Logger> configuredLoggers = Collections.synchronizedSet(new HashSet<>());
static { static {
LEVELS.map(LogLevel.TRACE, Level.FINEST); LEVELS.map(LogLevel.TRACE, Level.FINEST);
LEVELS.map(LogLevel.DEBUG, Level.FINE); LEVELS.map(LogLevel.DEBUG, Level.FINE);
@ -119,6 +122,7 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
} }
Logger logger = Logger.getLogger(loggerName); Logger logger = Logger.getLogger(loggerName);
if (logger != null) { if (logger != null) {
this.configuredLoggers.add(logger);
logger.setLevel(LEVELS.convertSystemToNative(level)); logger.setLevel(LEVELS.convertSystemToNative(level));
} }
} }
@ -159,6 +163,11 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
return new ShutdownHandler(); return new ShutdownHandler();
} }
@Override
public void cleanUp() {
this.configuredLoggers.clear();
}
private final class ShutdownHandler implements Runnable { private final class ShutdownHandler implements Runnable {
@Override @Override

Loading…
Cancel
Save