I am using JDK logging as a logging framework and SLF4J as simple facade. I have some queries when I log different level logs.
SLF4J has following log levels
trace (the least serious)<br>
debug<br>
info<br>
warn<br>
error<br>
fatal (the most serious)<br>
JDK logging has following log levels
SEVERE (highest value)<br>
WARNING<br>
INFO<br>
CONFIG<br>
FINE<br>
FINER<br>
FINEST (lowest value)<br>
If I want to set the log level to DEBUG then that level is not available in JDK logging. Can anybody please explain how can we get the DEBUG level logging in this situation. Do we need to do any additional configuration for this situation?
Updated
this is my property file configuration
handlers = com.amc.logging.handlers.DebugLogHandler
com.amc.logging.handlers.DebugLogHandler.pattern=c:/logs/debug_log.log
com.amc.logging.handlers.DebugLogHandler.level=FINE
com.amc.logging.handlers.DebugLogHandler.formatter=java.util.logging.SimpleFormatter
com.amc.logging.handlers.DebugLogHandler.append=true
Please let me know where I went wrong.
Spring Boot makes use of Apache Commons' Logging for its system logs by default. Additionally, by default you can use any of the logging frameworks under the SLF4J API such as Logback (which is the default), Log4J2, and Java Util Logging in Spring Boot.
The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
I have solved this issue with the help of bellow post.
slf4j logging with jdk – how to enable debug?
For DEBUG level logging in SLF4J we have to map FINE level in java.util.logging.
And we have to set the default logging level as FINE or lower level of FINE. This can be achieved by putting the bellow line in logging configuration file.
.level= FINE
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