Allow case insensitive logging.level properties

Fixes gh-3356
This commit is contained in:
Phillip Webb 2015-06-30 13:49:45 -07:00
parent 5a1e66b3d6
commit a89139c06b
2 changed files with 13 additions and 1 deletions

View File

@ -246,7 +246,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
name = null;
}
level = environment.resolvePlaceholders(level);
system.setLogLevel(name, LogLevel.valueOf(level));
system.setLogLevel(name, LogLevel.valueOf(level.toUpperCase()));
}
catch (RuntimeException ex) {
this.logger.error("Cannot set level: " + level + " for '" + name + "'");

View File

@ -210,6 +210,18 @@ public class LoggingApplicationListenerTests {
assertThat(this.outputCapture.toString(), containsString("testattrace"));
}
@Test
public void parseLevelsCaseInsensitive() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"logging.level.org.springframework.boot=TrAcE");
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
public void parseLevelsWithPlaceholder() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "foo=TRACE",