Last active
January 22, 2020 06:56
-
-
Save yusufcakal/be00dd4a49fc5e0a01d0a0d4469314a9 to your computer and use it in GitHub Desktop.
Gelen her request'e ait özel bir referans numarası ile log'un takip edilmesi
This file contains 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
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss.SSS} %clr([%thread]){magenta} %yellow([%X{requestId}]) %highlight(%-5level) %cyan(%-40.40logger{40}) - %msg %n |
This file contains 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
@Component | |
public class Slf4jMDCFilter extends OncePerRequestFilter { | |
@Override | |
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws java.io.IOException, ServletException { | |
MDC.put("requestId", "Request ID: " + UUID.randomUUID().toString()); | |
chain.doFilter(request, response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment