I prefer to throw my own exceptions for business logic. For example I have a class com.mine.exception.DuplicateClientException. Is there some configuration where I can turn off printing the stack trace for package com.mine.exception ?
Something like:
logging.level.com.mine.exception=OFF
To disable this behavior, you must add a logback configuration file called logback. xml in your java classpath root. You can download this minimal logback. xml file and add it in the src/main/resources directory for a maven project or beside fr directory for a simple java project.
You can enable debug logging by specifying --debug when starting the application from the command-line. Spring Boot provides also a nice starting point for logback to configure some defaults, coloring etc. the base. xml file which you can simply include in your logback.
In application.properties you can add ‘logging.level.*=LEVEL’ where ‘LEVEL’ is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. * is responsible for package/class.
For example
logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
This means that root logger has WARN level. org.springframework.web is on DEBUG level, but all hibernates files are logged only ERROR.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With