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
This commit is contained in:
Andy Wilkinson 2017-11-06 12:25:52 +00:00
parent 4a9186b1b5
commit 723222aa95
2 changed files with 3 additions and 3 deletions

View File

@ -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 {
}
@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);
}

View File

@ -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;
* @author Stephane Nicoll
* @author Andy Wilkinson
*/
@Ignore
@RunWith(WebEndpointRunners.class)
public class LoggersEndpointWebIntegrationTests {