org.springframework.boot.actuate.logging.LoggersEndpoint Java Examples

The following examples show how to use org.springframework.boot.actuate.logging.LoggersEndpoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: edison-microservice   Author: otto-de   File: LoggersHtmlEndpoint.java    License: Apache License 2.0 6 votes vote down vote up
private List<Map<String,?>> getLoggers() {
    @SuppressWarnings({"unchecked", "raw"})
    final Map<String,?> loggers = (Map) loggersEndpoint.loggers().get("loggers");
    return loggers
            .keySet()
            .stream()
            .map(key -> key.contains("$") ? null : new HashMap<String,Object>() {{
                final LoggersEndpoint.SingleLoggerLevels logger = (LoggersEndpoint.SingleLoggerLevels) loggers.get(key);
                put("name", key);
                put("displayName", displayNameOf(key));
                put("configuredLevel", logger.getConfiguredLevel());
                put("effectiveLevel", logger.getEffectiveLevel());
            }})
            .filter(Objects::nonNull)
            .collect(toList());
}
 
Example #2
Source Project: ssh-shell-spring-boot   Author: fonimus   File: ActuatorCommand.java    License: Apache License 2.0 5 votes vote down vote up
public ActuatorCommand(ApplicationContext applicationContext, Environment environment,
                       SshShellProperties properties, SshShellHelper helper,
                       @Lazy AuditEventsEndpoint audit, @Lazy BeansEndpoint beans,
                       @Lazy ConditionsReportEndpoint conditions,
                       @Lazy ConfigurationPropertiesReportEndpoint configprops, @Lazy EnvironmentEndpoint env,
                       @Lazy HealthEndpoint health,
                       @Lazy HttpTraceEndpoint httptrace, @Lazy InfoEndpoint info, @Lazy LoggersEndpoint loggers,
                       @Lazy MetricsEndpoint metrics,
                       @Lazy MappingsEndpoint mappings, @Lazy ScheduledTasksEndpoint scheduledtasks,
                       @Lazy ShutdownEndpoint shutdown,
                       @Lazy ThreadDumpEndpoint threaddump) {
    this.applicationContext = applicationContext;
    this.environment = environment;
    this.properties = properties;
    this.helper = helper;
    this.audit = audit;
    this.beans = beans;
    this.conditions = conditions;
    this.configprops = configprops;
    this.env = env;
    this.health = health;
    this.httptrace = httptrace;
    this.info = info;
    this.loggers = loggers;
    this.metrics = metrics;
    this.mappings = mappings;
    this.scheduledtasks = scheduledtasks;
    this.shutdown = shutdown;
    this.threaddump = threaddump;
}
 
Example #3
Source Project: ssh-shell-spring-boot   Author: fonimus   File: ActuatorCommand.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Loggers method
 *
 * @param action      action to make
 * @param loggerName  logger name for get or configure
 * @param loggerLevel logger level for configure
 * @return loggers
 */
@ShellMethod(key = "loggers", value = "Display or configure loggers.")
@ShellMethodAvailability("loggersAvailability")
public Object loggers(
        @ShellOption(value = {"-a", "--action"}, help = "Action to perform", defaultValue = "list") LoggerAction action,
        @ShellOption(value = {"-n", "--name"}, help = "Logger name for configuration or display", defaultValue =
                ShellOption.NULL) String loggerName,
        @ShellOption(value = {"-l", "--level"}, help = "Logger level for configuration", defaultValue =
                ShellOption.NULL) LogLevel loggerLevel) {
    if ((action == LoggerAction.get || action == LoggerAction.conf) && loggerName == null) {
        throw new IllegalArgumentException("Logger name is mandatory for '" + action + "' action");
    }
    switch (action) {
        case get:
            LoggersEndpoint.LoggerLevels levels = loggers.loggerLevels(loggerName);
            return "Logger named [" + loggerName + "] : [configured: " + levels.getConfiguredLevel() + "]";
        case conf:
            if (loggerLevel == null) {
                throw new IllegalArgumentException("Logger level is mandatory for '" + action + "' action");
            }
            loggers.configureLogLevel(loggerName, loggerLevel);
            return "Logger named [" + loggerName + "] now configured to level [" + loggerLevel + "]";
        default:
            // list
            return loggers.loggers();
    }
}
 
Example #4
Source Project: edison-microservice   Author: otto-de   File: LoggersHtmlEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
public LoggersHtmlEndpoint(final LoggersEndpoint loggersEndpoint,
                           final NavBar rightNavBar,
                           final EdisonApplicationProperties applicationProperties) {
    this.loggersEndpoint = loggersEndpoint;
    this.applicationProperties = applicationProperties;
    rightNavBar.register(navBarItem(1, "Loggers", String.format("%s/loggers", applicationProperties.getManagement().getBasePath())));
}
 
Example #5
Source Project: edison-microservice   Author: otto-de   File: LoggersConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(prefix = "edison.logging.ui", name = "enabled", matchIfMissing = true)
public LoggersHtmlEndpoint loggersHtmlEndpoint(final LoggersEndpoint loggersEndpoint,
                                               final NavBar rightNavBar,
                                               final EdisonApplicationProperties properties) {
    return new LoggersHtmlEndpoint(loggersEndpoint, rightNavBar, properties);
}
 
Example #6
Source Project: sofa-dashboard-client   Author: sofastack   File: AppDimensionConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ActuatorLoggersDimension createLoggersDimension(LoggersEndpoint endpoint) {
    return new ActuatorLoggersDimension(endpoint);
}
 
Example #7
Source Project: sofa-dashboard-client   Author: sofastack   File: ActuatorLoggersDimension.java    License: Apache License 2.0 4 votes vote down vote up
public ActuatorLoggersDimension(LoggersEndpoint endpoint) {
    this.endpoint = endpoint;
}
 
Example #8
Source Project: sofa-dashboard-client   Author: sofastack   File: DimensionTestContext.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public ActuatorLoggersDimension createLoggersDimension(LoggersEndpoint endpoint) {
    return new ActuatorLoggersDimension(endpoint);
}
 
Example #9
Source Project: ssh-shell-spring-boot   Author: fonimus   File: ActuatorCommand.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @return whether `loggers` command is available
 */
public Availability loggersAvailability() {
    return availability("loggers", LoggersEndpoint.class);
}
 
Example #10
Source Project: sshd-shell-spring-boot   Author: anand1st   File: LoggersCommand.java    License: Apache License 2.0 4 votes vote down vote up
LoggersCommand(@Value("${sshd.system.command.roles.loggers}") String[] systemRoles,
        LoggersEndpoint loggersEndpoint) {
    super(systemRoles);
    this.loggersEndpoint = loggersEndpoint;
}