From f4dc090bae54bde7658e61c101d406c98a72ef0a Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 25 Aug 2014 10:06:22 -0700 Subject: [PATCH] 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 --- .../springframework/boot/context/web/ErrorPageFilter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 bd387136510..69ebc5a9b3c 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 @@ -143,7 +143,12 @@ class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer imple rethrow(ex); return; } - logger.error("Forwarding to error page", ex); + if (logger.isErrorEnabled()) { + String message = "Forwarding to error page from request [" + + request.getServletPath() + request.getPathInfo() + + "] due to exception [" + ex.getMessage() + "]"; + logger.error(message, ex); + } setErrorAttributes(request, 500, ex.getMessage()); request.setAttribute(ERROR_EXCEPTION, ex); request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName());