Search in sources :

Example 1 with SingleLoggerSummary

use of org.graylog2.rest.models.system.loggers.responses.SingleLoggerSummary in project graylog2-server by Graylog2.

the class LoggersResource method loggers.

@GET
@Timed
@ApiOperation(value = "List all loggers and their current levels")
@Produces(MediaType.APPLICATION_JSON)
public LoggersSummary loggers() {
    final Collection<LoggerConfig> loggerConfigs = getLoggerConfigs();
    final Map<String, SingleLoggerSummary> loggers = Maps.newHashMapWithExpectedSize(loggerConfigs.size());
    for (LoggerConfig config : loggerConfigs) {
        if (!isPermitted(RestPermissions.LOGGERS_READ, config.getName())) {
            continue;
        }
        final Level level = config.getLevel();
        loggers.put(config.getName(), SingleLoggerSummary.create(level.toString().toLowerCase(Locale.ENGLISH), level.intLevel()));
    }
    return LoggersSummary.create(loggers);
}
Also used : SingleLoggerSummary(org.graylog2.rest.models.system.loggers.responses.SingleLoggerSummary) Level(org.apache.logging.log4j.Level) LoggerConfig(org.apache.logging.log4j.core.config.LoggerConfig) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 Level (org.apache.logging.log4j.Level)1 LoggerConfig (org.apache.logging.log4j.core.config.LoggerConfig)1 SingleLoggerSummary (org.graylog2.rest.models.system.loggers.responses.SingleLoggerSummary)1