public class RequestLoggerFilter
extends org.springframework.web.filter.OncePerRequestFilter
RequestLoggerFilter times http requests and logs the result in a tab separated fashion. Logs the following attributes if they are available:
RequestLoggerFilter uses org.slf4j.MDC for storing a unique request id which can be referred to in logfiles.
The unique id can be added to any logfile by adding the %X{requestId} parameter.
The same id can found in the request header attribute "Request-Reference".
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTRIBUTE_START_TIME |
static String |
ATTRIBUTE_UNIQUE_ID |
static String |
HEADER_REQUEST_ID |
static String |
LOG_INSTANCEID |
static String |
LOG_REQUESTID |
| Constructor and Description |
|---|
RequestLoggerFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doFilterInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain) |
Collection<String> |
getExcludedPathPatterns() |
Collection<String> |
getIncludedPathPatterns() |
void |
setExcludedPathPatterns(@NonNull Collection<String> excludedPathPatterns) |
void |
setIncludedPathPatterns(@NonNull Collection<String> includedPathPatterns) |
void |
setInstanceId(String instanceId) |
void |
setLoggerLevelThreshold(LoggerLevelThreshold loggerLevelThreshold) |
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatchpublic static final String HEADER_REQUEST_ID
public static final String LOG_INSTANCEID
public static final String LOG_REQUESTID
public static final String ATTRIBUTE_UNIQUE_ID
public static final String ATTRIBUTE_START_TIME
public void setInstanceId(String instanceId)
protected void doFilterInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
throws javax.servlet.ServletException,
IOException
doFilterInternal in class org.springframework.web.filter.OncePerRequestFilterjavax.servlet.ServletExceptionIOExceptionpublic Collection<String> getIncludedPathPatterns()
public void setIncludedPathPatterns(@NonNull
@NonNull Collection<String> includedPathPatterns)
public Collection<String> getExcludedPathPatterns()
public void setExcludedPathPatterns(@NonNull
@NonNull Collection<String> excludedPathPatterns)
public void setLoggerLevelThreshold(LoggerLevelThreshold loggerLevelThreshold)
Copyright © 2020. All rights reserved.