Merge branch '1.5.x'

pull/7992/head
Stephane Nicoll 8 years ago
commit e4876eb666

@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
* Adapter to expose {@link LoggersEndpoint} as an {@link MvcEndpoint}. * Adapter to expose {@link LoggersEndpoint} as an {@link MvcEndpoint}.
* *
* @author Ben Hale * @author Ben Hale
* @author Kazuki Shimizu
* @since 1.5.0 * @since 1.5.0
*/ */
@ConfigurationProperties(prefix = "endpoints.loggers") @ConfigurationProperties(prefix = "endpoints.loggers")
@ -71,7 +72,8 @@ public class LoggersMvcEndpoint extends EndpointMvcAdapter {
return getDisabledResponse(); return getDisabledResponse();
} }
String level = configuration.get("configuredLevel"); String level = configuration.get("configuredLevel");
this.delegate.setLogLevel(name, level == null ? null : LogLevel.valueOf(level)); LogLevel logLevel = level == null ? null : LogLevel.valueOf(level.toUpperCase());
this.delegate.setLogLevel(name, logLevel);
return HttpEntity.EMPTY; return HttpEntity.EMPTY;
} }

@ -131,7 +131,7 @@ public class LoggersMvcEndpointTests {
@Test @Test
public void setLoggerShouldSetLogLevel() throws Exception { public void setLoggerShouldSetLogLevel() throws Exception {
this.mvc.perform(post("/loggers/ROOT").contentType(MediaType.APPLICATION_JSON) this.mvc.perform(post("/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\":\"DEBUG\"}")).andExpect(status().isOk()); .content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isOk());
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
} }

Loading…
Cancel
Save