I would to measure processing time for each HTTP request in Spring Boot application (like access.log).
For example I could implement GenericFilterBean:
doFilter(ServletRequest request, ServletResponse response, FilterChain chain){
long start = now();
try {
chain.doFilter(request, response);
} finally {
long stop = now();
print(stop - start);
}
}
If I implement @RestControllerAdvice to handle every exception, then measuring time in doFilter will work good enough (I know there could be issue with filter exceptions).
But there is a problem with 404, because the request does no touch any @RestController and request does not reach @RestControllerAdvice.
Request will pass through GenericFilterBean and next Tomcat will dispatch the request to ErrorController with status 404.
For me request is completed when ErrorController is completed. But I do not know how to track the request from entry point to exit point when request is dispatched as error