Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom MdcSerializer in EcsLayout #291

Open
aliaksandr-lavishak-tde opened this issue Nov 26, 2024 · 1 comment
Open

Add support for custom MdcSerializer in EcsLayout #291

aliaksandr-lavishak-tde opened this issue Nov 26, 2024 · 1 comment
Labels
agent-java community Issues and PRs created by the community triage Issues and PRs that need to be triaged

Comments

@aliaksandr-lavishak-tde
Copy link

aliaksandr-lavishak-tde commented Nov 26, 2024

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

@github-actions github-actions bot added agent-java community Issues and PRs created by the community triage Issues and PRs that need to be triaged labels Nov 26, 2024
@aliaksandr-lavishak-tde
Copy link
Author

I created an example implementation of how it could look.
#293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-java community Issues and PRs created by the community triage Issues and PRs that need to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant