2 years ago
#372319
Ratoone
Jaeger traceId not showing in logs
I am trying to add the traceId to the logs of a Java Spring project for easier debugging. Tracing is already present in the project using opentracing:
@Bean
public Tracer tracer() {
Tracer tracer = TracerResolver.resolveTracer();
if (tracer != null) {
GlobalTracer.registerIfAbsent(tracer);
}
return GlobalTracer.get();
}
The logging uses slf4j with log4j and the pattern:
"%d %-5p trace=%X{traceId} [%c{1}] - %m%n"
However, in the logs, there is no traceId present. How could this be added?
On another note, checking the full MDC (by using %X), I see a _requestId field. Is it different from traceId?
java
log4j
jaeger
0 Answers
Your Answer