elastic / elastic/ecs-logging-java

Add support for custom MdcSerializer in EcsLayout

Offen
#291 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
agent-java community triage
Vorherrschende Sprache
Java
Sterne
148
Forks
82
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
3

Beschreibung

### Summary
`EcsLayout` from `log4j2-ecs-layout` currently uses a hardcoded implementation of `MdcSerializer` for MDC serialization. While this works well for most cases, it lacks flexibility for users with custom MDC serialization requirements.

I propose adding support for configuring or overriding the `MdcSerializer` implementation to accommodate specific use cases, such as:

- Custom JSON structure for MDC fields.
- Enhanced MDC sanitization or transformation logic.
- Integrating additional logging contexts.

### Problem Statement
The current implementation of `MdcSerializer` is resolved dynamically using `MdcSerializer.Resolver`. However, it does not allow users to provide their own `MdcSerializer` implementation.

### Proposed Solution
Introduce a mechanism to customize the `MdcSerializer`, such as already implemented for `ObjectMessageJacksonSerializer`

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.