4

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

3
  • 1
    logging.level.root=ERROR Commented Jul 27, 2018 at 19:42
  • @Compass thanks, why don't you add that as an answer with a link to docs and I'll accept it. Commented Jul 27, 2018 at 19:43
  • this helps me to reduce my logs so i can focus logging on errors that happen in my system Commented Jun 10, 2024 at 10:21

2 Answers 2

6

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
Sign up to request clarification or add additional context in comments.

Comments

0

You can also use this property

logging.level.root=INFO,ERROR,DEBUG

2 Comments

does not work..
this doesn't work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.