elastic / ecs-logging-java

https://www.elastic.co/guide/en/ecs-logging/java/current/intro.html
Apache License 2.0
139 stars 74 forks source link

Implement fallback MDC implementation for JUL #190

Closed SylvainJuge closed 1 year ago

SylvainJuge commented 1 year ago

Part of https://github.com/elastic/apm-agent-java/issues/2492

Adds a fallback MDC implementation for JUL that can be used by the APM agent, usage within ECS logging will only read any key/values in the MDC, values will be populated by the APM agent.


Checklist

apmmachine commented 1 year ago

:green_heart: Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

#### Build stats * Start Time: 2022-08-01T15:26:59.793+0000 * Duration: 7 min 33 sec #### Test stats :test_tube: | Test | Results | | ------------ | :-----------------------------: | | Failed | 0 | | Passed | 245 | | Skipped | 0 | | Total | 245 |

:robot: GitHub comments

To re-run your PR in the CI, just comment with:

felixbarny commented 1 year ago

@eyalkoren correct me if I'm wrong but I think the idea was to not rely on the MDC from slf4j at all anymore. Instead remove MdcSupplier and add a MDC class with static methods similar to org.slf4j.MDC.

eyalkoren commented 1 year ago

@eyalkoren correct me if I'm wrong but I think the idea was to not rely on the MDC from slf4j at all anymore. Instead remove MdcSupplier and add a MDC class with static methods similar to org.slf4j.MDC.

Correct, that's the preferable option described in https://github.com/elastic/apm-agent-java/issues/2492#issue-1158621899, and the less preferable alternative described is to rely on slf4j MDC