Skip to content

Commit f4dc090

Browse files
committed
Add a little more context to ErrorPageFilter log
Add the servlet and context path along with the exception message to the error logged in ErrorPageFilter. See gh-1427
1 parent 2d67452 commit f4dc090

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ private void handleException(HttpServletRequest request,
143143
rethrow(ex);
144144
return;
145145
}
146-
logger.error("Forwarding to error page", ex);
146+
if (logger.isErrorEnabled()) {
147+
String message = "Forwarding to error page from request ["
148+
+ request.getServletPath() + request.getPathInfo()
149+
+ "] due to exception [" + ex.getMessage() + "]";
150+
logger.error(message, ex);
151+
}
147152
setErrorAttributes(request, 500, ex.getMessage());
148153
request.setAttribute(ERROR_EXCEPTION, ex);
149154
request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName());

0 commit comments

Comments
 (0)