Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 291
David542 Avatar asked Sep 07 '25 11:09

David542


1 Answers

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
like image 157
Compass Avatar answered Sep 10 '25 01:09

Compass