|
18 | 18 |
|
19 | 19 | import java.io.File;
|
20 | 20 | import java.io.IOException;
|
| 21 | +import java.util.Collections; |
21 | 22 | import java.util.List;
|
22 | 23 | import java.util.concurrent.CountDownLatch;
|
23 | 24 | import java.util.concurrent.TimeUnit;
|
|
47 | 48 | import org.springframework.context.event.ContextClosedEvent;
|
48 | 49 | import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
49 | 50 | import org.springframework.context.support.GenericApplicationContext;
|
| 51 | +import org.springframework.core.env.MapPropertySource; |
| 52 | +import org.springframework.core.env.MutablePropertySources; |
50 | 53 | import org.springframework.test.context.support.TestPropertySourceUtils;
|
51 | 54 | import org.springframework.test.util.ReflectionTestUtils;
|
52 | 55 |
|
@@ -481,6 +484,17 @@ public void environmentPropertiesIgnoreUnresolvablePlaceholders() {
|
481 | 484 | assertThat(System.getProperty("CONSOLE_LOG_PATTERN")).isEqualTo("console ${pid}");
|
482 | 485 | }
|
483 | 486 |
|
| 487 | + @Test |
| 488 | + public void lowPriorityPropertySourceShouldNotOverrideRootLoggerConfig() throws Exception { |
| 489 | + MutablePropertySources propertySources = this.context.getEnvironment().getPropertySources(); |
| 490 | + propertySources.addFirst(new MapPropertySource("test1", Collections.<String, Object>singletonMap("logging.level.ROOT", "DEBUG"))); |
| 491 | + propertySources.addLast(new MapPropertySource("test2", Collections.<String, Object>singletonMap("logging.level.root", "WARN"))); |
| 492 | + this.initializer.initialize(this.context.getEnvironment(), |
| 493 | + this.context.getClassLoader()); |
| 494 | + this.logger.debug("testatdebug"); |
| 495 | + assertThat(this.outputCapture.toString()).contains("testatdebug"); |
| 496 | + } |
| 497 | + |
484 | 498 | @Test
|
485 | 499 | public void logFilePropertiesCanReferenceSystemProperties() {
|
486 | 500 | TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
|
|
0 commit comments