-
Notifications
You must be signed in to change notification settings - Fork 9
Support for ELASTIC_APM_ENABLE_LOG_CORRELATION - log4j2 #6
Comments
@adrianj I created a new release that populates MDC with https://github.com/michaelhyatt/elastic-apm-mule4-agent/releases/tag/v0.0.3 |
@michaelhyatt sorry I just saw this comment, I'm not accustomed to checking my Github notifications. I will test it out in the next few days and let you know how it goes 👍 |
Hello, mule kernel log:
log4j2.xml
mule4.template.application.log - trace.id and transaction.id appear as empty strings.
|
After digging a little deeper and attaching a debugger, I'm finding this behaviour:
Possibly the thread that put the ids is a different thread to the mule logger component, and different to the thread that ends the transaction. system property |
Could it be the AsyncLogger? If not, it may require extending the log4j:
```
Log4j 2.7 adds a flexible mechanism to tag logging statements with context
data coming from other sources than the ThreadContext. See the manual page
on extending Log4j
<https://logging.apache.org/log4j/2.x/manual/extending.html#Custom_ContextDataInjector>
for
details.
```
If there was only a way to log the trace.id value in the payload of the
message, the Logs UI in Kibana would pick it up, since the search string it
is using is trace.id : "XXX" OR "XXX" which caters for trace.id logged in
the message field of the logged event.
…On Mon, 31 Aug 2020 at 12:03, Adrian Jongenelen ***@***.***> wrote:
After digging a little deeper and attaching a debugger, I'm finding this
behaviour:
1. The MDC.put is being called for trace.id and transaction.id
2. Looking at org.apache.logging.log4j.ThreadContext class, the
correlationId is put many times within the flow, whereas trace.id is
only put once.
3. On the MDC.remove, the trace.id and transaction.id aren't there
anymore, though the correlationId is.
Possibly the thread that put the ids is a different thread to the mule
logger component, and different to the thread that ends the transaction.
system property log4j2.isThreadContextMapInheritable=true does not seem
to make any difference.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADXR5DOCR2CO32ZOIEU43MDSDMAGDANCNFSM4OSMCKRQ>
.
|
Hi - this is pretty much a duplicate of a similar issue in the mule3-agent.
michaelhyatt/elastic-apm-mule3-agent#24
Regardless of if I have
ELASTIC_APM_ENABLE_LOG_CORRELATION=true
, the%X{trace.id}
and%X{transaction.id}
are always empty. The%X{correlationId}
does work.Mule Kernel 4.2.0
AdoptOpenJDK 1.8
mule4-agent 0.0.2
mule-apikit-module 1.3.3
The text was updated successfully, but these errors were encountered: