Created
May 1, 2021 18:32
-
-
Save boudhayan-dev/fc172be7bfe29df3d1bde43f91d9d8c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LogFilter implements Filter { | |
public static final Logger log = LoggerFactory.getLogger(LogFilter.class); | |
@Override | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) | |
throws IOException, ServletException { | |
HttpServletRequest req = (HttpServletRequest) request; | |
MDC.put("LOGID", UUID.randomUUID().toString()); | |
log.info("Received HTTP request for API : {} ",req.getRequestURI()); | |
chain.doFilter(request, response); | |
} | |
@Override | |
public void init(FilterConfig filterconfig) throws ServletException { | |
} | |
@Override | |
public void destroy() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment