Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'logging.threshold.console' not working #36741

Closed
larsgrefer opened this issue Aug 4, 2023 · 3 comments
Closed

Property 'logging.threshold.console' not working #36741

larsgrefer opened this issue Aug 4, 2023 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@larsgrefer
Copy link
Contributor

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)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 4, 2023
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 4, 2023
@wilkinsona wilkinsona added this to the 3.1.x milestone Aug 4, 2023
@wilkinsona
Copy link
Member

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.

@StareStarrySky
Copy link

StareStarrySky commented Aug 5, 2023

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

@LucasJC
Copy link

LucasJC commented Aug 15, 2023

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: main...LucasJC:spring-boot:issue-36741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

6 participants