Skip to content

Commit a89139c

Browse files
committed
Allow case insensitive logging.level properties
Fixes gh-3356
1 parent 5a1e66b commit a89139c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private void setLogLevel(LoggingSystem system, Environment environment, String n
246246
name = null;
247247
}
248248
level = environment.resolvePlaceholders(level);
249-
system.setLogLevel(name, LogLevel.valueOf(level));
249+
system.setLogLevel(name, LogLevel.valueOf(level.toUpperCase()));
250250
}
251251
catch (RuntimeException ex) {
252252
this.logger.error("Cannot set level: " + level + " for '" + name + "'");

spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ public void parseLevels() throws Exception {
210210
assertThat(this.outputCapture.toString(), containsString("testattrace"));
211211
}
212212

213+
@Test
214+
public void parseLevelsCaseInsensitive() throws Exception {
215+
EnvironmentTestUtils.addEnvironment(this.context,
216+
"logging.level.org.springframework.boot=TrAcE");
217+
this.initializer.initialize(this.context.getEnvironment(),
218+
this.context.getClassLoader());
219+
this.logger.debug("testatdebug");
220+
this.logger.trace("testattrace");
221+
assertThat(this.outputCapture.toString(), containsString("testatdebug"));
222+
assertThat(this.outputCapture.toString(), containsString("testattrace"));
223+
}
224+
213225
@Test
214226
public void parseLevelsWithPlaceholder() throws Exception {
215227
EnvironmentTestUtils.addEnvironment(this.context, "foo=TRACE",

0 commit comments

Comments
 (0)