From 51496b4e4f41da1a5bf6811874d23b20f16de03d Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Sat, 21 Jun 2014 09:32:36 +0100 Subject: [PATCH] Log exception in ErrorPageFilter Fixes gh-1130 --- .../boot/context/web/ErrorPageFilter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java index 1f58bf84da..e31ac849ff 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java @@ -136,18 +136,18 @@ class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer imple request.setAttribute(ERROR_EXCEPTION, ex); request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName()); wrapped.sendError(500, ex.getMessage()); - forwardToErrorPage(errorPath, request, wrapped); + forwardToErrorPage(errorPath, request, wrapped, ex); } private void forwardToErrorPage(String path, HttpServletRequest request, - ServletResponse response) throws ServletException, IOException { + ServletResponse response, Throwable ex) throws ServletException, IOException { if (!response.isCommitted()) { String message = "Cannot forward to error page for" + request.getRequestURI() + " (response is committed), so this response may have " + "the wrong status code"; - // User might see the error page without all the data here but the exception - // isn't going to help anyone (and it's already been logged) - logger.error(message); + // User might see the error page without all the data here but throwing the + // exception isn't going to help anyone (we'll log it to be on the safe side) + logger.error(message, ex); return; } response.reset();