try {
// some code
}
catch (Exception e) {
Logger.log(Level.WARN, "Unable to complete the job. ID: " + id, e);
}
So, obviously a developer expects if something goes wrong, it would log the exception (exception type & stacktrace)
Here is the log print which I got
[27 May 2019 13:30:07][http-nio-8080-exec-13][WARN]: Unable to complete the job. ID: 123457890
Here is the Log4j config
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=debug.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss}][%t][%p]: %m%n
I know ways to get the exception details, I want to understand this behavior. How does this happen? Does the logger ignore the passed on parameters?