You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was found using Spring Boot 3.2.4 and Java 21. Seems related to #36741.
Steps to reproduce
Build jar for any Spring Boot app that is using the default logging setup - i.e. spring-boot-starter-logging with no logback.xml or other config files, just logging.* properties set in application.yml.
Set logging.threshold.console to "off" in application.yml or application-{profile}.yml:
logging:
threshold:
console: off
Run app: java -jar path/to/app.jar
Expected result
Only Spring banner printed to console, all logging goes to log file (if configured).
Actual result
All logging appears on console.
Observations
Running the app with this command instead produces expected result, with or without the same set in application.yml: java -Dlogging.threshold.console=off -jar path/to/app.jar
philwebb
changed the title
Property logging.threshold.console is not effective unless set as Java system property
Property logging.threshold.console is easy to misconfigure in yaml
Apr 5, 2024
I think we might be able to do more to protect against this. Perhaps we can automatically convert false to off
wilkinsona
changed the title
Property logging.threshold.console is easy to misconfigure in yaml
Make it harder to misconfigure logging.threshold.console in yaml
Apr 5, 2024
This was found using Spring Boot 3.2.4 and Java 21. Seems related to #36741.
Steps to reproduce
logging.*
properties set in application.yml.logging.threshold.console
to "off" in application.yml or application-{profile}.yml:java -jar path/to/app.jar
Expected result
Only Spring banner printed to console, all logging goes to log file (if configured).
Actual result
All logging appears on console.
Observations
Running the app with this command instead produces expected result, with or without the same set in application.yml:
java -Dlogging.threshold.console=off -jar path/to/app.jar
Not sure if this could be relevant, but I noticed that the
start()
method is called directly on theThresholdFilter
, rather than usingconfig.start(filter)
:https://github.com/spring-projects/spring-boot/blob/v3.2.4/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java#L108
The text was updated successfully, but these errors were encountered: