This was found using Spring Boot 3.2.4 and Java 21. Seems related to #36741.

Steps to reproduce

  1. 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.
  2. Set logging.threshold.console to "off" in application.yml or application-{profile}.yml:
logging:
  threshold:
    console: off
  1. 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

Not sure if this could be relevant, but I noticed that the start() method is called directly on the ThresholdFilter, rather than using config.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

Comment From: mhalbritter

Hey, thanks for the report, but I can't reproduce this. If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

Comment From: mhalbritter

Ah! It's a YAML thing.

logging.threshold.console: off

doesn't work.

logging.threshold.console: "off"

works.

YAML translates off to false, so make sure to quote it.

Comment From: philwebb

I think we might be able to do more to protect against this. Perhaps we can automatically convert false to off