-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement
Description
Dale Ogilvie opened SPR-17399 and commented
We have a ControllerAdvice exceptionHandler which logs 404 at INFO, as this is not an error we care about. However, ExceptionHandlerExceptionResolver logs at WARN after calling our handler. This should not happen.
Example log:
2018-10-18 10:24:43,594 BELLHOP INFO main * HttpClient Error: 404 Not Found, ErrorMessage [url=/api/platforms/NOTFOUND/radio, reason={"message":"No configuration found for NOTFOUND"}] * api.RestExceptionHandlerController * main * nz.co.trimble.bellhop.api.RestExceptionHandlerController
2018-10-18 10:24:43,631 BELLHOP WARN main * Resolved [org.springframework.web.client.HttpClientErrorException: 404 Not Found] * annotation.ExceptionHandlerExceptionResolver * main * org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
@Override
public ModelAndView resolveException(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
if (shouldApplyTo(request, handler)) {
prepareResponse(ex, response);
ModelAndView result = doResolveException(request, response, handler, ex);
if (result != null) {
// Print warn message when warn logger is not enabled...
if (logger.isWarnEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) {
logger.warn("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result));
}
// warnLogger with full stack trace (requires explicit config)
logException(ex, request);
}
return result;
}
else {
return null;
}
}
Affects: 4.3.19
Issue Links:
- ExceptionHandlerExceptionResolver started to log on WARN level [SPR-17383] #21916 ExceptionHandlerExceptionResolver started to log on WARN level ("duplicates")
- Consistent warn logging for handled exceptions [SPR-17178] #21714 Consistent warn logging for handled exceptions
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement