Skip to content

Commit 2835085

Browse files
committed
Polish
1 parent 28abcf8 commit 2835085

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -164,23 +164,14 @@ private Level getEffectiveLevel(Logger root) {
164164

165165
@Override
166166
public Runnable getShutdownHandler() {
167-
return new ShutdownHandler();
167+
return () -> LogManager.getLogManager().reset();
168168
}
169169

170170
@Override
171171
public void cleanUp() {
172172
this.configuredLoggers.clear();
173173
}
174174

175-
private static final class ShutdownHandler implements Runnable {
176-
177-
@Override
178-
public void run() {
179-
LogManager.getLogManager().reset();
180-
}
181-
182-
}
183-
184175
/**
185176
* {@link LoggingSystemFactory} that returns {@link JavaLoggingSystem} if possible.
186177
*/

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private LoggerConfiguration convertLoggerConfig(String name, LoggerConfig logger
301301

302302
@Override
303303
public Runnable getShutdownHandler() {
304-
return new ShutdownHandler();
304+
return () -> getLoggerContext().stop();
305305
}
306306

307307
@Override
@@ -341,15 +341,6 @@ private void markAsUninitialized(LoggerContext loggerContext) {
341341
loggerContext.setExternalContext(null);
342342
}
343343

344-
private final class ShutdownHandler implements Runnable {
345-
346-
@Override
347-
public void run() {
348-
getLoggerContext().stop();
349-
}
350-
351-
}
352-
353344
/**
354345
* {@link LoggingSystemFactory} that returns {@link Log4J2LoggingSystem} if possible.
355346
*/

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public void setLogLevel(String loggerName, LogLevel level) {
281281

282282
@Override
283283
public Runnable getShutdownHandler() {
284-
return new ShutdownHandler();
284+
return () -> getLoggerContext().stop();
285285
}
286286

287287
private ch.qos.logback.classic.Logger getLogger(String name) {
@@ -328,15 +328,6 @@ private void markAsUninitialized(LoggerContext loggerContext) {
328328
loggerContext.removeObject(LoggingSystem.class.getName());
329329
}
330330

331-
private final class ShutdownHandler implements Runnable {
332-
333-
@Override
334-
public void run() {
335-
getLoggerContext().stop();
336-
}
337-
338-
}
339-
340331
/**
341332
* {@link LoggingSystemFactory} that returns {@link LogbackLoggingSystem} if possible.
342333
*/

0 commit comments

Comments
 (0)