Datadog Mule Integration 4 APM
Logging
The Logger operation in the Datadog APM Connector for Mule 4 applications, is a log4j-complaint logger. This will follow the same lifecycle as the regular Mule Logger operation.
https://docs.mulesoft.com/mule-runtime/4.3/logger-component-reference
The Logger operation logs a given message into the corresponding Span. Logs linked to the span will be visible by clicking on the Traces tab inside the Span in the Datadog APM.
The Logger operation supports the following configurations.
-
Display name: By default is displayed as Logger.
-
Connector Configuration: Required.
-
Span name: Span in which the information will be logged, required.
-
Message: The message this log has, required.
-
Logging Level: logged to the span. default is INFO.
-
Category: An extra field to indicate the Category of the log. optional.
To use this operation, you need to configure the appended in the log4j2.xml file in your project as the below example. This will help to forward the logs captured in Log4J2 to the Datadog Log platform. Note that there's a system variable, ddApiKey, that is passed at runtime.
<Http name="DD-HTTP" url="https://http-intake.logs.datadoghq.com/v1/input" verifyHostname="false" method="POST">
<Property name="DD-API-KEY" value="${sys:ddApiKey}" />
<JSONLayout compact="false" eventEol="true" properties="true" stacktraceAsString="true">
<KeyValuePair key="host" value="${sys:domain}" />
<KeyValuePair key="appName" value="${sys:domain}" />
<KeyValuePair key="ddsource" value="mule" />
<KeyValuePair key="service" value="mule" />
<KeyValuePair key="correlationId" value="$${ctx:correlationId:-}"/>
</JSONLayout>
</Http>
In Studio, you can configure this variable as a VM argument.