Update test to check file name and support URL sources
Closes gh-45398
This commit is contained in:
@@ -159,7 +159,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
||||
Configuration configuration = this.loggingSystem.getConfiguration();
|
||||
assertThat(output).contains("Hello world").doesNotContain("Hidden");
|
||||
assertThat(new File(tmpDir() + "/spring.log")).exists();
|
||||
assertThat(configuration.getConfigurationSource().getFile()).isNotNull();
|
||||
assertThat(configuration.getConfigurationSource().getLocation()).contains("/log4j2-file.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
import org.apache.logging.log4j.core.config.Configuration;
|
||||
|
||||
class TestLog4J2LoggingSystem extends Log4J2LoggingSystem {
|
||||
@@ -34,7 +35,11 @@ class TestLog4J2LoggingSystem extends Log4J2LoggingSystem {
|
||||
}
|
||||
|
||||
Configuration getConfiguration() {
|
||||
return ((org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false)).getConfiguration();
|
||||
return getLoggerContext().getConfiguration();
|
||||
}
|
||||
|
||||
private LoggerContext getLoggerContext() {
|
||||
return (LoggerContext) LogManager.getContext(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user