Class OtlpJsonEncoder

All Implemented Interfaces:
LogEncoder

Encodes each event as one line of OTLP/JSON: a complete LogsData object holding a single log record. This is the OpenTelemetry file format, read by the OpenTelemetry Collector's otlpjsonfile receiver or by the filelog receiver with the otlpjson connector, so it needs no network connection.

Each record carries the formatted message as its body, the logger name as its instrumentation scope, thread.name, thread.id, every key value, and for a throwable exception.type, exception.message, and exception.stacktrace attributes. Event thread and exception attributes take precedence over context values with the same names. Key values named by traceIdKey and spanIdKey (default traceId and spanId, as Micrometer Tracing puts them in the MDC) become the record's trace context when they are valid W3C ids.