open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Unify structured logging attribute configuration and capture by default
@copilot-swe-agent is already working on this.
Since Sep 9, 2026.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
Logging bridges use separate experimental properties for event-local structured fields:
- Log4j
map-message-attributes.includedandmap-message-attributes.excluded - Logback
key-value-pair-attributes.includedandkey-value-pair-attributes.excluded - Logback
logstash-marker-attributes.includedandlogstash-marker-attributes.excluded - Logback
logstash-structured-argument-attributes.includedandlogstash-structured-argument-attributes.excluded
These sources all become OpenTelemetry log attributes, but users must configure each source separately. Structured fields deliberately attached to a logging event are also dropped by default.
Describe the solution you'd like
Introduce common selectors for event-local structured logging fields:
otel.instrumentation.common.logging.structured-attributes.includedotel.instrumentation.common.logging.structured-attributes.excludedjava.common.logging.structured_attributes.includedjava.common.logging.structured_attributes.excluded
Apply them to Log4j MapMessage entries, SLF4J key-value pairs, Logback Logstash markers, and Logback Logstash structured arguments.
Use the normal all-by-default selector semantics. An absent or empty selector keeps all structured fields, an omitted included list keeps everything not excluded, and an exclude-only selector keeps everything except the excluded fields. Configure excluded=* to capture nothing. Keep existing value conversion, attribute collision precedence, and special handling for otel.event.name.
Keep MDC and logger-context selectors separate and opt-in because they contain ambient context rather than fields deliberately attached to the event.
Use the 3.0 transition to replace the source-specific experimental properties.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.