Merge branch '1.1.x'

pull/1688/head
Dave Syer 10 years ago
commit 9ba7a1860f

@ -224,7 +224,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
for (Entry<String, Object> entry : levels.entrySet()) { for (Entry<String, Object> entry : levels.entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
try { try {
LogLevel level = LogLevel.valueOf(entry.getValue().toString()); LogLevel level = LogLevel.valueOf(environment.resolvePlaceholders(entry.getValue().toString()));
if (name.equalsIgnoreCase("root")) { if (name.equalsIgnoreCase("root")) {
name = null; name = null;
} }

@ -204,6 +204,18 @@ public class LoggingApplicationListenerTests {
assertThat(this.outputCapture.toString(), containsString("testattrace")); assertThat(this.outputCapture.toString(), containsString("testattrace"));
} }
@Test
public void parseLevelsWithPlaceholder() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "foo=TRACE",
"logging.level.org.springframework.boot=${foo}");
this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader());
this.logger.debug("testatdebug");
this.logger.trace("testattrace");
assertThat(this.outputCapture.toString(), containsString("testatdebug"));
assertThat(this.outputCapture.toString(), containsString("testattrace"));
}
@Test @Test
public void parseLevelsFails() throws Exception { public void parseLevelsFails() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,

Loading…
Cancel
Save