Skip to content

Unwanted Logback status messages are sometimes logged during startup #34505

@naivetoby

Description

@naivetoby

Hello,

I am a Java developer and I have found an issue with the SpringBoot 3.0.4 framework in the org.springframework.boot.logging.logback.LogbackLoggingSystem class, specifically on line 280.

The current code is as follows:

private void stopAndReset(LoggerContext loggerContext) {
    loggerContext.stop();
    loggerContext.reset();
    if (isBridgeHandlerInstalled()) {
        addLevelChangePropagator(loggerContext);
    }
}

I would like to suggest a modification to this method:

private void stopAndReset(LoggerContext loggerContext) {
    loggerContext.stop();
    loggerContext.reset();

    // FIXME: At this point, all initial default states (including appenders and filters) of loggerContext have been cleared.
    // If other loggers are still printing logs (such as org.springframework.jndi.JndiTemplate which reads environment variable values from <springProperty scope="context" ...>),
    // a warning noAppenderDefinedWarning will be issued, causing StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext) to be executed.
    // This will ultimately result in a large amount of unimportant logs being printed before SpringBoot completes startup.

    loggerContext.getTurboFilterList().add(FILTER);

    if (isBridgeHandlerInstalled()) {
        addLevelChangePropagator(loggerContext);
    }
}

I hope this suggestion is helpful. Thank you for your work on this open source software.

Best regards,

Toby

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions