use of org.springframework.boot.logging.LogLevel in project spring-boot by spring-projects.
the class LoggersEndpointTests method invokeShouldReturnConfigurations.
@Test
@SuppressWarnings("unchecked")
public void invokeShouldReturnConfigurations() throws Exception {
given(getLoggingSystem().getLoggerConfigurations()).willReturn(Collections.singletonList(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG)));
given(getLoggingSystem().getSupportedLogLevels()).willReturn(EnumSet.allOf(LogLevel.class));
Map<String, Object> result = getEndpointBean().invoke();
Map<String, LoggerLevels> loggers = (Map<String, LoggerLevels>) result.get("loggers");
Set<LogLevel> levels = (Set<LogLevel>) result.get("levels");
LoggerLevels rootLevels = loggers.get("ROOT");
assertThat(rootLevels.getConfiguredLevel()).isNull();
assertThat(rootLevels.getEffectiveLevel()).isEqualTo("DEBUG");
assertThat(levels).containsExactly(LogLevel.OFF, LogLevel.FATAL, LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG, LogLevel.TRACE);
}
use of org.springframework.boot.logging.LogLevel in project spring-boot by spring-projects.
the class LoggersEndpointMBean method setLogLevel.
@ManagedOperation(description = "Set log level for a given logger")
public void setLogLevel(String loggerName, String logLevel) {
Assert.notNull(logLevel, "LogLevel must not be null");
LogLevel level = LogLevel.valueOf(logLevel.toUpperCase());
getEndpoint().setLogLevel(loggerName, level);
}
Aggregations