Update logger MDC docs (after
@@ -11,19 +11,19 @@ by a logging library.
The OTel Java agent injects several pieces of information about the current span into each logging
event's MDC copy:
-- `traceId` - the current trace id
+- `trace_id` - the current trace id
(same as `Span.current().getSpanContext().getTraceId()`);
-- `spanId` - the current span id
+- `span_id` - the current span id
(same as `Span.current().getSpanContext().getSpanId()`);
-- `sampled` - a boolean flag marking whether the current span is sampled or not
- (same as `Span.current().getSpanContext().isSampled()`).
+- `trace_flags` - the current trace flags, formatted according to W3C traceflags format
+ (same as `Span.current().getSpanContext().getTraceFlags().asHex()`).
Those three pieces of information can be included in log statements produced by the logging library
by specifying them in the pattern/format. Example for Spring Boot configuration (which uses
logback):
```properties
-logging.pattern.console = %d{yyyy-MM-dd HH:mm:ss} - %logger{36} - %msg trace_id=%X{traceId} span_id=%X{spanId} %n
+logging.pattern.console = %d{yyyy-MM-dd HH:mm:ss} - %logger{36} - %msg trace_id=%X{trace_id} span_id=%X{span_id} trace_flags=%X{trace_flags} %n
```
This way any services or tools that parse the application logs can correlate traces/spans with log
