|
|
|
@ -38,6 +38,7 @@ import ch.qos.logback.core.ConsoleAppender;
|
|
|
|
|
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
|
|
|
|
import ch.qos.logback.core.rolling.RollingFileAppender;
|
|
|
|
|
import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
|
|
|
|
|
import ch.qos.logback.core.util.DynamicClassLoadingException;
|
|
|
|
|
import ch.qos.logback.core.util.StatusPrinter;
|
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
@ -676,6 +677,16 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|
|
|
|
assertThat(output).contains("<springProfile> elements cannot be nested within an");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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) {
|
|
|
|
|
this.loggingSystem.getSystemProperties((ConfigurableEnvironment) context.getEnvironment()).apply(logFile);
|
|
|
|
|
this.loggingSystem.initialize(context, configLocation, logFile);
|
|
|
|
|