|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.core.Ordered; |
|
|
|
import org.springframework.core.Ordered; |
|
|
|
|
|
|
|
import org.springframework.core.log.LogFormatUtils; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver; |
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver; |
|
|
|
@ -142,7 +143,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti |
|
|
|
if (result != null) { |
|
|
|
if (result != null) { |
|
|
|
// Print debug message when warn logger is not enabled.
|
|
|
|
// Print debug message when warn logger is not enabled.
|
|
|
|
if (logger.isDebugEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) { |
|
|
|
if (logger.isDebugEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) { |
|
|
|
logger.debug("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result)); |
|
|
|
logger.debug(buildLogMessage(ex, request) + (result.isEmpty() ? "" : " to " + result)); |
|
|
|
} |
|
|
|
} |
|
|
|
// Explicitly configured warn logger in logException method.
|
|
|
|
// Explicitly configured warn logger in logException method.
|
|
|
|
logException(ex, request); |
|
|
|
logException(ex, request); |
|
|
|
@ -207,7 +208,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti |
|
|
|
* @return the log message to use |
|
|
|
* @return the log message to use |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected String buildLogMessage(Exception ex, HttpServletRequest request) { |
|
|
|
protected String buildLogMessage(Exception ex, HttpServletRequest request) { |
|
|
|
return "Resolved [" + ex + "]"; |
|
|
|
return "Resolved [" + LogFormatUtils.formatValue(ex, -1, true) + "]"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|