Skip to content

Commit 51496b4

Browse files
author
Dave Syer
committed
Log exception in ErrorPageFilter
Fixes gh-1130
1 parent 772df9b commit 51496b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-boot/src/main/java/org/springframework/boot/context/web/ErrorPageFilter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,18 @@ private void handleException(HttpServletRequest request,
136136
request.setAttribute(ERROR_EXCEPTION, ex);
137137
request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName());
138138
wrapped.sendError(500, ex.getMessage());
139-
forwardToErrorPage(errorPath, request, wrapped);
139+
forwardToErrorPage(errorPath, request, wrapped, ex);
140140
}
141141

142142
private void forwardToErrorPage(String path, HttpServletRequest request,
143-
ServletResponse response) throws ServletException, IOException {
143+
ServletResponse response, Throwable ex) throws ServletException, IOException {
144144
if (!response.isCommitted()) {
145145
String message = "Cannot forward to error page for" + request.getRequestURI()
146146
+ " (response is committed), so this response may have "
147147
+ "the wrong status code";
148-
// User might see the error page without all the data here but the exception
149-
// isn't going to help anyone (and it's already been logged)
150-
logger.error(message);
148+
// User might see the error page without all the data here but throwing the
149+
// exception isn't going to help anyone (we'll log it to be on the safe side)
150+
logger.error(message, ex);
151151
return;
152152
}
153153
response.reset();

0 commit comments

Comments
 (0)