Skip to content

Commit 6ea3441

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 73db208 commit 6ea3441

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
@@ -136,8 +136,8 @@ public ModelAndView resolveException(
136136
ModelAndView result = doResolveException(request, response, handler, ex);
137137
if (result != null) {
138138
// Print warn message when warn logger is not enabled...
139-
if (logger.isWarnEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) {
140-
logger.warn("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result));
139+
if (logger.isDebugEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) {
140+
logger.debug("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result));
141141
}
142142
// warnLogger with full stack trace (requires explicit config)
143143
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
@@ -159,6 +159,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
159159
*/
160160
public DefaultHandlerExceptionResolver() {
161161
setOrder(Ordered.LOWEST_PRECEDENCE);
162+
setWarnLogCategory(getClass().getName());
162163
}
163164

164165

0 commit comments

Comments
 (0)