java.lang.Object | |||
↳ | org.springframework.web.filter.GenericFilterBean | ||
↳ | org.springframework.web.filter.OncePerRequestFilter | ||
↳ | org.springframework.web.filter.AbstractRequestLoggingFilter |
Known Direct Subclasses |
Base class for Filter
s that perform logging operations before and after a request is processed.
Subclasses should override the beforeRequest(HttpServletRequest, String)
and
afterRequest(HttpServletRequest, String)
methods to perform the actual logging around the request.
Subclasses are passed the message to write to the log in the beforeRequest
and
afterRequest
methods. By default, only the URI of the request is logged. However, setting the
includeQueryString
property to true
will cause the query string of the request to be
included also. The payload (body) of the request can be logged via the includePayload
flag. Note that
this will only log that which is read, which might not be the entire payload.
Prefixes and suffixes for the before and after messages can be configured using the
beforeMessagePrefix
, afterMessagePrefix
, beforeMessageSuffix
and
afterMessageSuffix
properties,
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_AFTER_MESSAGE_PREFIX | ||||||||||
String | DEFAULT_AFTER_MESSAGE_SUFFIX | ||||||||||
String | DEFAULT_BEFORE_MESSAGE_PREFIX | ||||||||||
String | DEFAULT_BEFORE_MESSAGE_SUFFIX |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.filter.OncePerRequestFilter
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.filter.GenericFilterBean
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Set the value that should be prepended to the log message written after a request is processed.
| |||||||||||
Set the value that should be appended to the log message written after a request is processed.
| |||||||||||
Set the value that should be prepended to the log message written before a request is processed.
| |||||||||||
Set the value that should be apppended to the log message written before a request is processed.
| |||||||||||
Set whether or not the client address and session id should be included in the log message.
| |||||||||||
Set whether or not the request payload (body) should be included in the log message.
| |||||||||||
Set whether or not the query string should be included in the log message.
| |||||||||||
Sets the maximum length of the payload body to be included in the log message.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Concrete subclasses should implement this method to write a log message after the request is processed.
| |||||||||||
Concrete subclasses should implement this method to write a log message before the request is processed.
| |||||||||||
Create a log message for the given request, prefix and suffix.
| |||||||||||
Forwards the request to the next filter in the chain and delegates down to the subclasses to perform the actual
request logging both before and after the request is processed.
| |||||||||||
Return the maximum length of the payload body to be included in the log message.
| |||||||||||
Return whether or not the client address and session id should be included in the log message.
| |||||||||||
Return whether or not the request payload (body) should be included in the log message.
| |||||||||||
Return whether or not the query string should be included in the log message.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.filter.OncePerRequestFilter
| |||||||||||
From class
org.springframework.web.filter.GenericFilterBean
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
javax.servlet.Filter
| |||||||||||
From interface
org.springframework.beans.factory.BeanNameAware
| |||||||||||
From interface
org.springframework.beans.factory.DisposableBean
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.EnvironmentAware
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
|
Set the value that should be prepended to the log message written after a request is processed.
Set the value that should be appended to the log message written after a request is processed.
Set the value that should be prepended to the log message written before a request is processed.
Set the value that should be apppended to the log message written before a request is processed.
Set whether or not the client address and session id should be included in the log message.
Should be configured
using an <init-param>
for parameter name "includeClientInfo" in the filter definition in
web.xml
.
Set whether or not the request payload (body) should be included in the log message.
Should be configured using
an <init-param>
for parameter name "includePayload" in the filter definition in
web.xml
.
Set whether or not the query string should be included in the log message.
Should be configured using an
<init-param>
for parameter name "includeQueryString" in the filter definition in
web.xml
.
Sets the maximum length of the payload body to be included in the log message. Default is 50 characters.
Concrete subclasses should implement this method to write a log message after the request is processed.
request | current HTTP request |
---|---|
message | the message to log |
Concrete subclasses should implement this method to write a log message before the request is processed.
request | current HTTP request |
---|---|
message | the message to log |
Create a log message for the given request, prefix and suffix.
If includeQueryString
is
true
then the inner part of the log message will take the form request_uri?query_string
otherwise the message will simply be of the form request_uri
.
The final message is composed of the inner part as described and the supplied prefix and suffix.
Forwards the request to the next filter in the chain and delegates down to the subclasses to perform the actual request logging both before and after the request is processed.
IOException | |
---|---|
ServletException |
Return the maximum length of the payload body to be included in the log message.
Return whether or not the client address and session id should be included in the log message.
Return whether or not the request payload (body) should be included in the log message.
Return whether or not the query string should be included in the log message.