Allow case insensitive logging.level properties
Fixes gh-3356
This commit is contained in:
		
							parent
							
								
									5a1e66b3d6
								
							
						
					
					
						commit
						a89139c06b
					
				| 
						 | 
				
			
			@ -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 + "'");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue