Skip to content

Wrong log level from /actuator/loggers #45868

Closed as not planned
Closed as not planned
@cdprete

Description

@cdprete

Hello.

In my application I'm using Spring Boot 3.5.0 with the Log4j2 loggers configured externally as follows:

<Loggers>
    <Root level="info">
        <AppenderRef ref="ApplicationLogs"/>
        <AppenderRef ref="PatrolLogs"/>
        <AppenderRef ref="SplunkLogs"/>
    </Root>
    <Logger name="SplunkMeterRegistry" level="info" additivity="false">
        <AppenderRef ref="MetricsLogs"/>
    </Logger>
    <Logger name="InvalidMessagesLogger" level="warn" additivity="false">
        <AppenderRef ref="InvalidMsgsLogs"/>
    </Logger>
    <Logger name="com.netflix.eureka" level="OFF" additivity="false" />
    <Logger name="com.netflix.discovery" level="OFF" additivity="false" />
    <Logger name="foo.client.consumer" level="DEBUG"/>
</Loggers>

but then, in Spring Boot Admin as well as calling the GET /actuator/loggers, I can see all the loggers on DEBUG level:

Image

Moreover, according to the feedback provided in #45854, POST /loggers/{name} <body> should also work if the logging is configured externally (-Dlogging.config=config/log4j2-spring.xml in my case), but it doesn't.
Even if in Spring Boot Admin I change the log level, nothing happens.

On the contrary, the logging handling seems to be way worse now that I updated the application to Spring Boot 3.5.0, because the SplunkMeterRegistry is not dumping anymore the Micrometer metrics into the "log" file.
More info on it:

public class SplunkMeterRegistry extends StepMeterRegistry {
    ...
    private final static Logger metricsLogger = LoggerFactory.getLogger("SplunkMeterRegistry");
    private final StepRegistryConfig config;

    public SplunkMeterRegistry(StepRegistryConfig config, Clock clock) {
        super(config, clock);
        this.config = config;
        start(new NamedThreadFactory("logging-metrics-publisher"));
    }

    @Override
    protected void publish() {
        if (config.enabled())
            getMeters().forEach(meter -> metricsLogger.info("metric_name={}{}{}", meter.getId().getName(),
                    meter.getId().getTags().stream().map(m -> m.getKey() + "=" + m.getValue()).collect(Collectors.joining(",", ",", "")),
                    StreamSupport.stream(meter.measure().spliterator(), false).map(m -> m.getStatistic().name() + "=" + m.getValue()).collect(Collectors.joining(",", ",", ""))));
    }

    protected TimeUnit getBaseTimeUnit() {
        return TimeUnit.MILLISECONDS;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions