public class TraceIdLoggingWebMvcInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
HandlerInterceptor
that extracts the request
trace ID from the "x-cloud-trace-context" HTTP header and stores it in a thread-local
using TraceIdLoggingEnhancer.setCurrentTraceId(java.lang.String)
.
The TraceIdLoggingEnhancer
can then be used in a logging appender to add the
trace ID metadata to log messages.
Constructor and Description |
---|
TraceIdLoggingWebMvcInterceptor(TraceIdExtractor extractor) |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Object handler,
Exception e) |
TraceIdExtractor |
getTraceIdExtractor() |
boolean |
preHandle(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
Object handler) |
public TraceIdLoggingWebMvcInterceptor(TraceIdExtractor extractor)
public TraceIdExtractor getTraceIdExtractor()
public boolean preHandle(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Object handler) throws Exception
preHandle
in interface org.springframework.web.servlet.HandlerInterceptor
preHandle
in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
Exception
public void afterCompletion(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Object handler, Exception e) throws Exception
afterCompletion
in interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion
in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
Exception
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.