elastic / elastic/apm-agent-java

Add trace correlation to agent logs

Open
#2,495 0 comments 0 reactions 0 assignees View on GitHub
agent-java enhancement logging
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

## Is your feature request related to a problem?

When agent logs in ECS format, we can utilize log correlation to our logs as well.
## Describe the solution you'd like

We can enhance our `co.elastic.apm.agent.logging.Log4j2LoggerBridge` to add to slf4j MDC before any logging event and removing after if the log format is JSON.
## Describe alternatives you've considered

Another option is to utilize log4j extension capabilities - `org.apache.logging.log4j.core.util.ContextDataProvider` or `org.apache.logging.log4j.core.ContextDataInjector`
## Additional context

Followup on #2428

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.