Skip to content

Make it harder to misconfigure logging.threshold.console in yaml #40124

@zman0900

Description

@zman0900

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions