-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to put traceId in MDC #600
Comments
I think we can add new rules for "logback" ,"log4j","log4j2" |
if you want to get the traceid in a running thread, maybe you can use the following code to get the trace id. if(!GlobalTracer.isRegistered() || null == GlobalTracer.get().scopeManager().activeSpan()) {
// tracing is not activated
log.debug(String.format("tracing is not activated here."));
} else {
// tracing is activated
String traceId = GlobalTracer.get().scopeManager().activeSpan().context().toTraceId();
log.debug(String.format("trace id is %s", traceId));
} |
Thanks for your reply! I want to place this code in some rules without writing extra code. |
It is a good idea for my requirements. |
I want to print traceId in my log. I try to put traceId in MDC, then write %X{traceId} in logback.xml! How can I do it?
The text was updated successfully, but these errors were encountered: