|
37 | 37 | import ch.qos.logback.classic.spi.LoggerContextListener;
|
38 | 38 | import ch.qos.logback.core.ConsoleAppender;
|
39 | 39 | import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
|
| 40 | +import ch.qos.logback.core.joran.spi.JoranException; |
40 | 41 | import ch.qos.logback.core.rolling.RollingFileAppender;
|
41 | 42 | import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
|
42 | 43 | import ch.qos.logback.core.util.DynamicClassLoadingException;
|
@@ -848,8 +849,17 @@ void whenConfigLocationIsNotXmlThenIllegalArgumentExceptionShouldBeThrown() {
|
848 | 849 | assertThatIllegalStateException()
|
849 | 850 | .isThrownBy(() -> initialize(this.initializationContext, "classpath:logback-invalid-format.txt",
|
850 | 851 | getLogFile(tmpDir() + "/tmp.log", null)))
|
851 |
| - .satisfies((ex) -> assertThat(ex.getCause()).isInstanceOf(IllegalArgumentException.class) |
852 |
| - .hasMessageStartingWith("Unsupported file extension")); |
| 852 | + .satisfies((ex) -> assertThat(ex.getCause()).isInstanceOf(JoranException.class) |
| 853 | + .hasMessageStartingWith("Problem parsing XML document. See previously reported errors")); |
| 854 | + } |
| 855 | + |
| 856 | + @Test |
| 857 | + void whenConfigLocationIsXmlFileWithoutExtensionShouldWork(CapturedOutput output) { |
| 858 | + this.loggingSystem.beforeInitialize(); |
| 859 | + initialize(this.initializationContext, "classpath:logback-without-extension", |
| 860 | + getLogFile(tmpDir() + "/tmp.log", null)); |
| 861 | + this.logger.info("No extension and works!"); |
| 862 | + assertThat(output.toString()).contains("No extension and works!"); |
853 | 863 | }
|
854 | 864 |
|
855 | 865 | @Test
|
|
0 commit comments