In Quarkus, the default logging library is JBoss and using the quarkus-logging-json
allows you to encode your logs as JSON.
However, Datadog integration requires custom fields such as service
, dd.span_id
and dd.trace_id
to have the logs associated with the correct syntax.
Currently, I've tried adding this in application.properties
:
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p service=%X{myServiceName}, traceId=%X{dd.trace_id}, spanId=%X{dd.span_id} [%c{2.}] (%t) %s%e%n
However, this seems not to show up in Datadog as expected.
When we use log4j2, we simply configure it like so.
Appenders:
Console:
name: Console_Appender
target: SYSTEM_OUT
JSONLayout:
KeyValuePair:
- key: service
value: myServiceName
Again, cannot find any documentation how to accomplish the same result in Quarkus configs.
Does anyone know how I could inject these custom properties into the JSON logs with Quarkus or how to integrate it with Datadog properly?
I think the disconnect here is that the pattern needs to be in the Jboss log manager, and then they're encoded to JSON.
Have you tried putting
%X{dd.trace_id:-0} %X{dd.span_id:-0}
into your Jboss logging pattern?If not, I'd also recommend opening a ticket at [email protected] and we can work this through with you.