David542
David542

Reputation: 110163

How to only log ERRORs in spring boot

I only want to log errors in my spring boot application. This is what I have in my application.properties file:

logging.level.com.test.login=ERROR

However, that seems to only catch errors in my application. Is there a way to set it globally for everything, so I only see errors printed to my console, and nothing else? Now it prints tons of INFO statement:

enter image description here

Upvotes: 4

Views: 11475

Answers (2)

Compass
Compass

Reputation: 5937

From: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html

logging.level.root=ERROR
logging.level.org.foo.bar.baz=INFO

If you are using YAML, you can use the same basic layout for root, but for package-level, just write out the entire package in a single line rather than using tree format.

logging:
  level:
    root: ERROR
    org.foo.bar.baz: INFO

Upvotes: 6

Mohit Sharma
Mohit Sharma

Reputation: 492

You can also use this property

logging.level.root=INFO,ERROR,DEBUG

Upvotes: 0

Related Questions