Search in sources :

Example 1 with LoggerGroup

use of org.springframework.boot.logging.LoggerGroup in project spring-boot by spring-projects.

the class LoggersEndpoint method loggerLevels.

@ReadOperation
public LoggerLevels loggerLevels(@Selector String name) {
    Assert.notNull(name, "Name must not be null");
    LoggerGroup group = this.loggerGroups.get(name);
    if (group != null) {
        return new GroupLoggerLevels(group.getConfiguredLevel(), group.getMembers());
    }
    LoggerConfiguration configuration = this.loggingSystem.getLoggerConfiguration(name);
    return (configuration != null) ? new SingleLoggerLevels(configuration) : null;
}
Also used : LoggerConfiguration(org.springframework.boot.logging.LoggerConfiguration) LoggerGroup(org.springframework.boot.logging.LoggerGroup) ReadOperation(org.springframework.boot.actuate.endpoint.annotation.ReadOperation)

Example 2 with LoggerGroup

use of org.springframework.boot.logging.LoggerGroup in project spring-boot by spring-projects.

the class LoggersEndpoint method configureLogLevel.

@WriteOperation
public void configureLogLevel(@Selector String name, @Nullable LogLevel configuredLevel) {
    Assert.notNull(name, "Name must not be empty");
    LoggerGroup group = this.loggerGroups.get(name);
    if (group != null && group.hasMembers()) {
        group.configureLogLevel(configuredLevel, this.loggingSystem::setLogLevel);
        return;
    }
    this.loggingSystem.setLogLevel(name, configuredLevel);
}
Also used : LoggerGroup(org.springframework.boot.logging.LoggerGroup) WriteOperation(org.springframework.boot.actuate.endpoint.annotation.WriteOperation)

Aggregations

LoggerGroup (org.springframework.boot.logging.LoggerGroup)2 ReadOperation (org.springframework.boot.actuate.endpoint.annotation.ReadOperation)1 WriteOperation (org.springframework.boot.actuate.endpoint.annotation.WriteOperation)1 LoggerConfiguration (org.springframework.boot.logging.LoggerConfiguration)1