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)
,
org.apache.log4j.NDC#push(String)
,
org.apache.log4j.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_SUFFIX
ALREADY_FILTERED_SUFFIX
logger
Constructor and Description |
---|
Log4jNestedDiagnosticContextFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterRequest(HttpServletRequest request,
java.lang.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,
java.lang.String message)
Logs the before-request message through Log4J and
adds a message the Log4J NDC before the request is processed.
|
protected java.lang.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, shouldLog, shouldNotFilterAsyncDispatch
doFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatch
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
protected void beforeRequest(HttpServletRequest request, java.lang.String message)
beforeRequest
in class AbstractRequestLoggingFilter
request
- current HTTP requestmessage
- the message to logprotected java.lang.String getNestedDiagnosticContextMessage(HttpServletRequest request)
Default is a plain request log message without prefix or suffix.
request
- current HTTP requestAbstractRequestLoggingFilter.createMessage(HttpServletRequest, java.lang.String, java.lang.String)
protected void afterRequest(HttpServletRequest request, java.lang.String message)
afterRequest
in class AbstractRequestLoggingFilter
request
- current HTTP requestmessage
- the message to log