|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor
public class Log4jNestedDiagnosticContextInterceptor
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.
NDC.push(String)
,
NDC.pop()
Field Summary | |
---|---|
protected Logger |
log4jLogger
Logger available to subclasses |
Constructor Summary | |
---|---|
Log4jNestedDiagnosticContextInterceptor()
|
Method Summary | |
---|---|
void |
afterCompletion(WebRequest request,
Exception ex)
Removes the log message from the Log4J NDC after the request is processed. |
protected String |
getNestedDiagnosticContextMessage(WebRequest request)
Determine the message to be pushed onto the Log4J nested diagnostic context. |
protected boolean |
isIncludeClientInfo()
Return whether or not the session id and user name should be included in the log message. |
void |
postHandle(WebRequest request,
ModelMap model)
Intercept the execution of a request handler after its successful invocation, right before view rendering (if any). |
void |
preHandle(WebRequest request)
Adds a message the Log4J NDC before the request is processed. |
void |
setIncludeClientInfo(boolean includeClientInfo)
Set whether or not the session id and user name should be included in the log message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Logger log4jLogger
Constructor Detail |
---|
public Log4jNestedDiagnosticContextInterceptor()
Method Detail |
---|
public void setIncludeClientInfo(boolean includeClientInfo)
protected boolean isIncludeClientInfo()
public void preHandle(WebRequest request) throws Exception
preHandle
in interface WebRequestInterceptor
request
- the current web request
Exception
- in case of errorsprotected String getNestedDiagnosticContextMessage(WebRequest request)
Default is the request object's getDescription
result.
request
- current HTTP request
WebRequest.getDescription(boolean)
,
isIncludeClientInfo()
public void postHandle(WebRequest request, ModelMap model) throws Exception
WebRequestInterceptor
Allows for modifying context resources after successful handler execution (for example, flushing a Hibernate Session).
postHandle
in interface WebRequestInterceptor
request
- the current web requestmodel
- the map of model objects that will be exposed to the view
(may be null
). Can be used to analyze the exposed model
and/or to add further model attributes, if desired.
Exception
- in case of errorspublic void afterCompletion(WebRequest request, Exception ex) throws Exception
afterCompletion
in interface WebRequestInterceptor
request
- the current web requestex
- exception thrown on handler execution, if any
Exception
- in case of errors
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |