The property logging.threshold.console does not seem to work.

https://docs.spring.io/spring-boot/docs/3.1.2/reference/htmlsingle/#application-properties.core.logging.threshold.console

Steps to reproduce:

  1. Download a fresh and empty Spring Boot 3.1.2 project from start.spring.io
  2. Build it using ./gradlew bootJar
  3. Run it with java -jar .\build\libs\demo-0.0.1-SNAPSHOT.jar --logging.threshold.console=error

Expected Result:

I'd expect to only see the Spring-Banner, but no info messages, as the threshold should only allow errors to be printed to the console.

Actual Result

> java -jar .\build\libs\demo-0.0.1-SNAPSHOT.jar --logging.threshold.console=error

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.2)

2023-08-04T14:55:51.961+02:00  INFO 23524 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT using Java 17.0.6 with PID 23524 (C:\Users\GreferLars(Group)\Downloads\demo\demo\build\libs\demo-0.0.1-SNAPSHOT.jar started by GreferLars(Group) in C:\Users\GreferLars(Group)\Downloads\demo\demo)
2023-08-04T14:55:51.961+02:00  INFO 23524 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2023-08-04T14:55:52.448+02:00  INFO 23524 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.874 seconds (process running for 1.239)

Comment From: wilkinsona

Thanks for the report, @larsgrefer.

When using the default Java-based configuration, the ThresholdFilter is never started so it has no effect. It may work if you use XML and import Boot's config.

Comment From: StareStarrySky

So, next, fix this by identifying it in logback? or something else?

Comment From: LucasJC

Thanks for the report, @larsgrefer.

When using the default Java-based configuration, the ThresholdFilter is never started so it has no effect. It may work if you use XML and import Boot's config.

Hi! Could not we just start the filter when the default configuration is applied? I tried this locally and it does work.

PS: This is what I mean: https://github.com/spring-projects/spring-boot/compare/main...LucasJC:spring-boot:issue-36741