Skip to content

Commit 8a283e3

Browse files
committed
Update DefaultHandlerExceptionResolver logging
Reduce logging for NoResourceFoundException and NoHandlerFoundException. Closes gh-30884
1 parent 0d8a843 commit 8a283e3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,4 +662,15 @@ protected void sendServerError(Exception ex, HttpServletRequest request, HttpSer
662662
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
663663
}
664664

665+
@Override
666+
protected void logException(Exception ex, HttpServletRequest request) {
667+
if (ex instanceof NoHandlerFoundException || ex instanceof NoResourceFoundException) {
668+
if (logger.isDebugEnabled()) {
669+
logger.debug(buildLogMessage(ex, request));
670+
}
671+
return;
672+
}
673+
super.logException(ex, request);
674+
}
675+
665676
}

0 commit comments

Comments
 (0)