Package org.springframework.web.filter
Class Log4jNestedDiagnosticContextFilter
- java.lang.Object
- org.springframework.web.filter.GenericFilterBean
- org.springframework.web.filter.OncePerRequestFilter
- org.springframework.web.filter.AbstractRequestLoggingFilter
- org.springframework.web.filter.Log4jNestedDiagnosticContextFilter
- All Implemented Interfaces:
Filter
,Aware
,BeanNameAware
,DisposableBean
,InitializingBean
,EnvironmentAware
,EnvironmentCapable
,ServletContextAware
@Deprecated public class Log4jNestedDiagnosticContextFilter extends AbstractRequestLoggingFilter
Deprecated.as of Spring 4.2.1, in favor of Apache Log4j 2 (following Apache's EOL declaration for log4j 1.x)Request logging filter that adds the request log message to the Log4J nested diagnostic context (NDC) before the request is processed, removing it again after the request is processed.- Since:
- 1.2.5
- Author:
- Juergen Hoeller, Rob Harrop
- See Also:
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()
Field Summary
Fields Modifier and Type Field Description protected Logger
log4jLogger
Deprecated.Logger available to subclassesFields inherited from class org.springframework.web.filter.AbstractRequestLoggingFilter
DEFAULT_AFTER_MESSAGE_PREFIX, DEFAULT_AFTER_MESSAGE_SUFFIX, DEFAULT_BEFORE_MESSAGE_PREFIX, DEFAULT_BEFORE_MESSAGE_SUFFIX
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
Constructor Summary
Constructors Constructor Description Log4jNestedDiagnosticContextFilter()
Deprecated.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
afterRequest(HttpServletRequest request, String message)
Deprecated.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)
Deprecated.Logs the before-request message through Log4J and adds a message the Log4J NDC before the request is processed.protected String
getNestedDiagnosticContextMessage(HttpServletRequest request)
Deprecated.Determine the message to be pushed onto the Log4J nested diagnostic context.Methods inherited from class org.springframework.web.filter.AbstractRequestLoggingFilter
createMessage, doFilterInternal, getMaxPayloadLength, isIncludeClientInfo, isIncludeHeaders, isIncludePayload, isIncludeQueryString, setAfterMessagePrefix, setAfterMessageSuffix, setBeforeMessagePrefix, setBeforeMessageSuffix, setIncludeClientInfo, setIncludeHeaders, setIncludePayload, setIncludeQueryString, setMaxPayloadLength, shouldLog, shouldNotFilterAsyncDispatch
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatch
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
Field Detail
log4jLogger
protected final Logger log4jLogger
Deprecated.Logger available to subclasses
Constructor Detail
Log4jNestedDiagnosticContextFilter
public Log4jNestedDiagnosticContextFilter()
Deprecated.
Method Detail
beforeRequest
protected void beforeRequest(HttpServletRequest request, String message)
Deprecated.Logs the before-request message through Log4J and adds a message the Log4J NDC before the request is processed.- Specified by:
beforeRequest
in classAbstractRequestLoggingFilter
- Parameters:
request
- current HTTP requestmessage
- the message to log
getNestedDiagnosticContextMessage
protected String getNestedDiagnosticContextMessage(HttpServletRequest request)
Deprecated.Determine the message to be pushed onto the Log4J nested diagnostic context.Default is a plain request log message without prefix or suffix.
- Parameters:
request
- current HTTP request- Returns:
- the message to be pushed onto the Log4J NDC
- See Also:
AbstractRequestLoggingFilter.createMessage(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
afterRequest
protected void afterRequest(HttpServletRequest request, String message)
Deprecated.Removes the log message from the Log4J NDC after the request is processed and logs the after-request message through Log4J.- Specified by:
afterRequest
in classAbstractRequestLoggingFilter
- Parameters:
request
- current HTTP requestmessage
- the message to log