2

Is there a way to disable Spring boot logs and print only the logs which i give in the program using logger.info or logger.debug statements. I mean i want only the log statements which i had given in the program to be logged and nothing else. I use the default logging system given by spring boot. If required i can change to log4j or log4j2 as well. Using spring-boot version 1.2.7. In other way, putting forward , like logging.level.org.springframework can be used to log spring related logs ,is there a way like logging.level.applicationlevel to get application(Java logger statement) logs alone

2 Answers 2

6

You can configure your logging in your application.properties like below:

logging.level.com.myapp.packagename=INFO
logging.level.org.springframework=ERROR

INFO means it will print logging of classes in your package and all sub package at INFO/ERROR/WARN level, while for spring related classes only print if there are ERROR level logging.

Sign up to request clarification or add additional context in comments.

Comments

0

You can configure logging properties as follows:

logging.level.* = ERROR
logging.level.package_name=DEBUG

Example:
logging.level.com.example.controller=DEBUG

So classes under com.example.controller package will be logged, others only on error will be logged.

I hope this helped!!

Comments

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.