Class Log4jNestedDiagnosticContextInterceptor
- java.lang.Object
- org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor
- All Implemented Interfaces:
AsyncWebRequestInterceptor
,WebRequestInterceptor
@Deprecated public class Log4jNestedDiagnosticContextInterceptor extends Object implements AsyncWebRequestInterceptor
Deprecated.as of Spring 4.2.1, in favor of Apache Log4j 2 (following Apache's EOL declaration for log4j 1.x)Request logging interceptor that adds a request context message to the Log4J nested diagnostic context (NDC) before the request is processed, removing it again after the request is processed.- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
NDC.push(String)
,NDC.pop()
Field Summary
Fields Modifier and Type Field Description protected Logger
log4jLogger
Deprecated.Logger available to subclasses
Constructor Summary
Constructors Constructor Description Log4jNestedDiagnosticContextInterceptor()
Deprecated.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterCompletion(WebRequest request, Exception ex)
Deprecated.Removes the log message from the Log4J NDC after the request is processed.void
afterConcurrentHandlingStarted(WebRequest request)
Deprecated.Removes the log message from the Log4J NDC when the processing thread is exited after the start of asynchronous request handling.protected String
getNestedDiagnosticContextMessage(WebRequest request)
Deprecated.Determine the message to be pushed onto the Log4J nested diagnostic context.protected boolean
isIncludeClientInfo()
Deprecated.Return whether or not the session id and user name should be included in the log message.void
postHandle(WebRequest request, ModelMap model)
Deprecated.Intercept the execution of a request handler after its successful invocation, right before view rendering (if any).void
preHandle(WebRequest request)
Deprecated.Adds a message the Log4J NDC before the request is processed.void
setIncludeClientInfo(boolean includeClientInfo)
Deprecated.Set whether or not the session id and user name should be included in the log message.
Field Detail
log4jLogger
protected final Logger log4jLogger
Deprecated.Logger available to subclasses
Constructor Detail
Log4jNestedDiagnosticContextInterceptor
public Log4jNestedDiagnosticContextInterceptor()
Deprecated.
Method Detail
setIncludeClientInfo
public void setIncludeClientInfo(boolean includeClientInfo)
Deprecated.Set whether or not the session id and user name should be included in the log message.
isIncludeClientInfo
protected boolean isIncludeClientInfo()
Deprecated.Return whether or not the session id and user name should be included in the log message.
preHandle
public void preHandle(WebRequest request) throws Exception
Deprecated.Adds a message the Log4J NDC before the request is processed.- Specified by:
preHandle
in interfaceWebRequestInterceptor
- Parameters:
request
- the current web request- Throws:
Exception
- in case of errors
getNestedDiagnosticContextMessage
protected String getNestedDiagnosticContextMessage(WebRequest request)
Deprecated.Determine the message to be pushed onto the Log4J nested diagnostic context.Default is the request object's
getDescription
result.- Parameters:
request
- current HTTP request- Returns:
- the message to be pushed onto the Log4J NDC
- See Also:
WebRequest.getDescription(boolean)
,isIncludeClientInfo()
postHandle
public void postHandle(WebRequest request, ModelMap model) throws Exception
Deprecated.Description copied from interface:WebRequestInterceptor
Intercept the execution of a request handler after its successful invocation, right before view rendering (if any).Allows for modifying context resources after successful handler execution (for example, flushing a Hibernate Session).
- Specified by:
postHandle
in interfaceWebRequestInterceptor
- Parameters:
request
- the current web requestmodel
- the map of model objects that will be exposed to the view (may benull
). Can be used to analyze the exposed model and/or to add further model attributes, if desired.- Throws:
Exception
- in case of errors
afterCompletion
public void afterCompletion(WebRequest request, Exception ex) throws Exception
Deprecated.Removes the log message from the Log4J NDC after the request is processed.- Specified by:
afterCompletion
in interfaceWebRequestInterceptor
- Parameters:
request
- the current web requestex
- exception thrown on handler execution, if any- Throws:
Exception
- in case of errors
afterConcurrentHandlingStarted
public void afterConcurrentHandlingStarted(WebRequest request)
Deprecated.Removes the log message from the Log4J NDC when the processing thread is exited after the start of asynchronous request handling.- Specified by:
afterConcurrentHandlingStarted
in interfaceAsyncWebRequestInterceptor
- Parameters:
request
- the current request