Browse Source

Allow configuredLevel to be null when configuring a logger

Null value is used to indicate that the configured level should be
cleared.

Closes gh-10934
pull/10941/head
Andy Wilkinson 9 years ago
parent
commit
723222aa95
  1. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java
  2. 2
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java

@ -31,6 +31,7 @@ import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; @@ -31,6 +31,7 @@ import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggerConfiguration;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@ -76,7 +77,8 @@ public class LoggersEndpoint { @@ -76,7 +77,8 @@ public class LoggersEndpoint {
}
@WriteOperation
public void configureLogLevel(@Selector String name, LogLevel configuredLevel) {
public void configureLogLevel(@Selector String name,
@Nullable LogLevel configuredLevel) {
Assert.notNull(name, "Name must not be empty");
this.loggingSystem.setLogLevel(name, configuredLevel);
}

2
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java

@ -23,7 +23,6 @@ import java.util.EnumSet; @@ -23,7 +23,6 @@ import java.util.EnumSet;
import net.minidev.json.JSONArray;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
@ -54,7 +53,6 @@ import static org.mockito.Mockito.verifyZeroInteractions; @@ -54,7 +53,6 @@ import static org.mockito.Mockito.verifyZeroInteractions;
* @author Stephane Nicoll
* @author Andy Wilkinson
*/
@Ignore
@RunWith(WebEndpointRunners.class)
public class LoggersEndpointWebIntegrationTests {

Loading…
Cancel
Save