public class Log4jNestedDiagnosticContextFilter extends AbstractRequestLoggingFilter
AbstractRequestLoggingFilter.setIncludeQueryString(boolean),
AbstractRequestLoggingFilter.setBeforeMessagePrefix(java.lang.String),
AbstractRequestLoggingFilter.setBeforeMessageSuffix(java.lang.String),
AbstractRequestLoggingFilter.setAfterMessagePrefix(java.lang.String),
AbstractRequestLoggingFilter.setAfterMessageSuffix(java.lang.String),
NDC.push(String),
NDC.pop()| Modifier and Type | Field and Description |
|---|---|
protected Logger |
log4jLogger
Logger available to subclasses
|
DEFAULT_AFTER_MESSAGE_PREFIX, DEFAULT_AFTER_MESSAGE_SUFFIX, DEFAULT_BEFORE_MESSAGE_PREFIX, DEFAULT_BEFORE_MESSAGE_SUFFIXALREADY_FILTERED_SUFFIXlogger| Constructor and Description |
|---|
Log4jNestedDiagnosticContextFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterRequest(HttpServletRequest request,
String message)
Removes the log message from the Log4J NDC after the request is processed
and logs the after-request message through Log4J.
|
protected void |
beforeRequest(HttpServletRequest request,
String message)
Logs the before-request message through Log4J and
adds a message the Log4J NDC before the request is processed.
|
protected String |
getNestedDiagnosticContextMessage(HttpServletRequest request)
Determine the message to be pushed onto the Log4J nested diagnostic context.
|
createMessage, doFilterInternal, getMaxPayloadLength, isIncludeClientInfo, isIncludePayload, isIncludeQueryString, setAfterMessagePrefix, setAfterMessageSuffix, setBeforeMessagePrefix, setBeforeMessageSuffix, setIncludeClientInfo, setIncludePayload, setIncludeQueryString, setMaxPayloadLength, shouldNotFilterAsyncDispatchdoFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatchaddRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContextprotected final Logger log4jLogger
protected void beforeRequest(HttpServletRequest request, String message)
beforeRequest in class AbstractRequestLoggingFilterrequest - current HTTP requestmessage - the message to logprotected String getNestedDiagnosticContextMessage(HttpServletRequest request)
Default is a plain request log message without prefix or suffix.
request - current HTTP requestAbstractRequestLoggingFilter.createMessage(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)protected void afterRequest(HttpServletRequest request, String message)
afterRequest in class AbstractRequestLoggingFilterrequest - current HTTP requestmessage - the message to log