-
Notifications
You must be signed in to change notification settings - Fork 312
Description
DD_LOGS_INECTION
Environment Variable: DD_LOGS_INJECTION
Default: true
Enabled automatic MDC key injection for Datadog trace and span IDs. See Advanced Usage for details.
String traceId = MDC.get("dd.trace_id"); // null
String spanId = MDC.get("dd.span_id"); // null
I'm trying to access trace_id, span_id injected into MDC context in application code with DD_LOGS_INCTION option enabled. but, no value is injected into the MDC and NULL is returned.
"dd.trace_id":"%X{dd.trace_id}", "dd.span_id":"%X{dd.span_id}"
What I didn't understand is that when I output the logs, if I use the format in logback-spring.xml that uses the trace_id, span_id keys of the MDC context, the values are present in the output logs. I already know that if I add the dd-trace-api dependency to my project and use CorrelationIdentifier, it returns trace_id, span_id. I would like to avoid adding dependencies if possible. The documentation describes the keys as being automatically injected into the MDC context, do I necessarily need to use CorrelationIdentifier to access them?