|
|
|
@ -20,9 +20,7 @@ import java.io.File;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.logging.Handler;
|
|
|
|
|
import java.util.logging.LogManager;
|
|
|
|
|
|
|
|
|
@ -89,13 +87,10 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
|
|
|
|
|
|
private LoggingInitializationContext initializationContext;
|
|
|
|
|
|
|
|
|
|
private Set<Object> systemPropertyNames;
|
|
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
|
void setup() {
|
|
|
|
|
System.getProperties().remove(LoggingSystemProperties.CONSOLE_LOG_CHARSET);
|
|
|
|
|
System.getProperties().remove(LoggingSystemProperties.FILE_LOG_CHARSET);
|
|
|
|
|
this.systemPropertyNames = new HashSet<>(System.getProperties().keySet());
|
|
|
|
|
this.loggingSystem.cleanUp();
|
|
|
|
|
this.logger = ((LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory()).getLogger(getClass());
|
|
|
|
|
this.environment = new MockEnvironment();
|
|
|
|
@ -106,7 +101,6 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
|
|
|
|
|
|
@AfterEach
|
|
|
|
|
void cleanUp() {
|
|
|
|
|
System.getProperties().keySet().retainAll(this.systemPropertyNames);
|
|
|
|
|
this.loggingSystem.cleanUp();
|
|
|
|
|
((LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory()).stop();
|
|
|
|
|
}
|
|
|
|
@ -318,7 +312,6 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
|
@Test
|
|
|
|
|
void testLevelPatternProperty(CapturedOutput output) {
|
|
|
|
|
this.environment.setProperty("logging.pattern.level", "X%clr(%p)X");
|
|
|
|
|
new LoggingSystemProperties(this.environment).apply();
|
|
|
|
|
LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment);
|
|
|
|
|
initialize(loggingInitializationContext, null, null);
|
|
|
|
|
this.logger.info("Hello world");
|
|
|
|
@ -521,7 +514,6 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
|
@Test
|
|
|
|
|
void testDateformatPatternProperty(CapturedOutput output) {
|
|
|
|
|
this.environment.setProperty("logging.pattern.dateformat", "yyyy-MM-dd'T'hh:mm:ss.SSSZ");
|
|
|
|
|
new LoggingSystemProperties(this.environment).apply();
|
|
|
|
|
LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment);
|
|
|
|
|
initialize(loggingInitializationContext, null, null);
|
|
|
|
|
this.logger.info("Hello world");
|
|
|
|
|