Reputation: 187
I have a spring boot web application installed on tomcat7. I am looking for a way to log the http incoming and outcoming requests (header and body).I am looking for something similar to org.apache.cxf.interceptor.LoggingOutInterceptor. Can you help?
Upvotes: 1
Views: 3252
Reputation: 1479
You could implement your own filter like:
@Component
public class SimpleFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
// logic...
chain.doFilter(req, res);
}
public void init(FilterConfig filterConfig) {}
public void destroy() {}
}
This is also a good solution for both of your requirements to intercept requests and response...
Upvotes: 3