|
|
@ -38,6 +38,7 @@ import ch.qos.logback.core.ConsoleAppender;
|
|
|
|
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
|
|
|
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
|
|
|
import ch.qos.logback.core.rolling.RollingFileAppender;
|
|
|
|
import ch.qos.logback.core.rolling.RollingFileAppender;
|
|
|
|
import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
|
|
|
|
import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
|
|
|
|
|
|
|
|
import ch.qos.logback.core.util.DynamicClassLoadingException;
|
|
|
|
import ch.qos.logback.core.util.StatusPrinter;
|
|
|
|
import ch.qos.logback.core.util.StatusPrinter;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
@ -771,6 +772,16 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
assertThat(getLineWithText(output, "Hello world")).doesNotContain("myapp");
|
|
|
|
assertThat(getLineWithText(output, "Hello world")).doesNotContain("myapp");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void whenConfigurationErrorIsDetectedUnderlyingCausesAreIncludedAsSuppressedExceptions() {
|
|
|
|
|
|
|
|
this.loggingSystem.beforeInitialize();
|
|
|
|
|
|
|
|
assertThatIllegalStateException()
|
|
|
|
|
|
|
|
.isThrownBy(() -> initialize(this.initializationContext, "classpath:logback-broken.xml",
|
|
|
|
|
|
|
|
getLogFile(tmpDir() + "/tmp.log", null)))
|
|
|
|
|
|
|
|
.satisfies((ex) -> assertThat(ex.getSuppressed())
|
|
|
|
|
|
|
|
.hasAtLeastOneElementOfType(DynamicClassLoadingException.class));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void initialize(LoggingInitializationContext context, String configLocation, LogFile logFile) {
|
|
|
|
private void initialize(LoggingInitializationContext context, String configLocation, LogFile logFile) {
|
|
|
|
this.loggingSystem.getSystemProperties((ConfigurableEnvironment) context.getEnvironment()).apply(logFile);
|
|
|
|
this.loggingSystem.getSystemProperties((ConfigurableEnvironment) context.getEnvironment()).apply(logFile);
|
|
|
|
this.loggingSystem.beforeInitialize();
|
|
|
|
this.loggingSystem.beforeInitialize();
|
|
|
|