I want to log activities in spring boot enabled application. I want to log “Request info”, controller “method activity” and “Response Info” In order of time. I tried to use OncePerRequestFilter and found it great. But there is a problem. To log request header body info by calling request.getContentAsByteArray() it is available for after execution of filterChain.doFilter(request, response). It means that I can log request header body content after controller method is called!!!
- Log Request info
- Log controller method
- Log Request header body
- Log Response Info
- Log Response body
Step 2,3 should be swap. How? Thanks