Skip to content

Commit 8e980d9

Browse files
committed
Restore log level for resolved exceptions
The fix for SPR-17178 switched from debug to warn level warning for all sub-classes of AbstractHandlerExceptionResolver where the request concerned the DefaultHandlerExceptionResolver only. This commit restores the original DEBUG level logging that was in AbstractHandlerExceptionResolver from before SPR-17178. In addition DefaultHandlerExceptionResolver registers a warnLogCategory by default which enables warn logging and hence fulfilling the original goal for SPR-17178. Issue: SPR-17383
1 parent f7c625c commit 8e980d9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ public ModelAndView resolveException(
132132
ModelAndView result = doResolveException(request, response, handler, ex);
133133
if (result != null) {
134134
// Print warn message when warn logger is not enabled...
135-
if (logger.isWarnEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) {
136-
logger.warn("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result));
135+
if (logger.isDebugEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) {
136+
logger.debug("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result));
137137
}
138138
// warnLogger with full stack trace (requires explicit config)
139139
logException(ex, request);

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
9797
*/
9898
public DefaultHandlerExceptionResolver() {
9999
setOrder(Ordered.LOWEST_PRECEDENCE);
100+
setWarnLogCategory(getClass().getName());
100101
}
101102

102103

0 commit comments

Comments
 (0)