After upgrading to Spring Boot 3.0.1, I get the following "error" when running my application:
07:56:13,126 |-INFO in ch.qos.logback.classic.LoggerContext[default] - This is logback-classic version 1.4.5
07:56:13,135 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
07:56:13,135 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.xml]
07:56:13,135 |-INFO in ch.qos.logback.classic.BasicConfigurator@2783717b - Setting up default configuration.
......
Downgrading to Spring Boot 3.0.0 removes this.
Comment From: philwebb
This is likely caused by #33610 but those messages should only happen if there's a warning. Do you have a sample application we can run that replicates the problem?
Comment From: pandrez
Hi @philwebb I'm also having the same issue. Like requested, I created a really simple app that replicates the problem.
Running the sample app with any profile generates those log messages on startup.
Comment From: bjorntj
Was thinking about this and that I had not created a test project yet but I guess I do not have to now.. :)
Comment From: philwebb
Thanks for the sample @pandrez. It looks like in your case the messages are being logged because there is still a warning. If I run the app I see:
12:11:18,540 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@7f485fda - Propagating WARN level on Logger[org.springframework.boot.actuate.endpoint.jmx] onto the JUL framework
12:11:18,540 |-WARN in ch.qos.logback.core.model.processor.AppenderModelHandler - Appender named [CONSOLE] not referenced. Skipping further processing.
12:11:18,540 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [CONSOLE_JSON]
That warning is coming from AppenderModelHandler and happens because there's a CONSOLE appender that isn't referenced.
If I change your config to the following:
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<springProfile name="local">
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
</springProfile>
<appender name="CONSOLE_JSON" class="ch.qos.logback.core.ConsoleAppender">
...
I don't get the warning.
Comment From: philwebb
@bjorntj Does your application have a similar configuration? Are you seeing any |-WARN in messages or do you only get |-INFO messages?
Comment From: pandrez
@philwebb Thank you for your help!
With your feedback, I understood what the problem is. Defining an appender outside the <springProfile> tag when that appender is only used for that given profile generates a warning when a different profile is used.
I solved the problem by defining the profile-specific appenders inside the <springProfile> tag.
Once again, thank you for your support.
Comment From: bjorntj
Yes, you are correct.. I had several appenders that wasn't referenced. I guess this is something that changed from 3.0.0 to 3.0.1?
Comment From: wilkinsona
Thanks for letting us know. The improved reporting of problems with the configuration is due to the changes made for https://github.com/spring-projects/spring-boot/issues/33610.
Comment From: 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
Comment From: philwebb
@thinktkj Thanks for comment, but it's better if you don't raise the same thing on multiple issues. Let's use #34505 to discuss your suggestion.