|
|
@ -362,6 +362,22 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
.toString()).isEqualTo("100 MB");
|
|
|
|
.toString()).isEqualTo("100 MB");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testMaxFileSizePropertyWithXmlConfiguration() throws Exception {
|
|
|
|
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
|
|
|
|
|
environment.setProperty("logging.file.max-size", "100MB");
|
|
|
|
|
|
|
|
LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(
|
|
|
|
|
|
|
|
environment);
|
|
|
|
|
|
|
|
File file = new File(tmpDir(), "logback-test.log");
|
|
|
|
|
|
|
|
LogFile logFile = getLogFile(file.getPath(), null);
|
|
|
|
|
|
|
|
this.loggingSystem.initialize(loggingInitializationContext,
|
|
|
|
|
|
|
|
"classpath:logback-include-base.xml", logFile);
|
|
|
|
|
|
|
|
this.logger.info("Hello world");
|
|
|
|
|
|
|
|
assertThat(getLineWithText(file, "Hello world")).contains("INFO");
|
|
|
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(getRollingPolicy(), "maxFileSize")
|
|
|
|
|
|
|
|
.toString()).isEqualTo("100 MB");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testMaxHistoryProperty() throws Exception {
|
|
|
|
public void testMaxHistoryProperty() throws Exception {
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
@ -376,6 +392,21 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
assertThat(getRollingPolicy().getMaxHistory()).isEqualTo(30);
|
|
|
|
assertThat(getRollingPolicy().getMaxHistory()).isEqualTo(30);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testMaxHistoryPropertyWithXmlConfiguration() throws Exception {
|
|
|
|
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
|
|
|
|
|
environment.setProperty("logging.file.max-history", "30");
|
|
|
|
|
|
|
|
LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(
|
|
|
|
|
|
|
|
environment);
|
|
|
|
|
|
|
|
File file = new File(tmpDir(), "logback-test.log");
|
|
|
|
|
|
|
|
LogFile logFile = getLogFile(file.getPath(), null);
|
|
|
|
|
|
|
|
this.loggingSystem.initialize(loggingInitializationContext,
|
|
|
|
|
|
|
|
"classpath:logback-include-base.xml", logFile);
|
|
|
|
|
|
|
|
this.logger.info("Hello world");
|
|
|
|
|
|
|
|
assertThat(getLineWithText(file, "Hello world")).contains("INFO");
|
|
|
|
|
|
|
|
assertThat(getRollingPolicy().getMaxHistory()).isEqualTo(30);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void exceptionsIncludeClassPackaging() throws Exception {
|
|
|
|
public void exceptionsIncludeClassPackaging() throws Exception {
|
|
|
|
this.loggingSystem.beforeInitialize();
|
|
|
|
this.loggingSystem.beforeInitialize();
|
|
|
|