open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Unify structured logging attribute configuration and capture by default

Open
#19,854 0 comments 1 reaction 2 assignees View on GitHub

@copilot-swe-agent is already working on this.

Since Sep 9, 2026.

  • #20047 by @copilot-swe-agent — closed without merging
  • #20066 by @copilot-swe-agent — open
enhancement needs triage
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.included and map-message-attributes.excluded
  • Logback key-value-pair-attributes.included and key-value-pair-attributes.excluded
  • Logback logstash-marker-attributes.included and logstash-marker-attributes.excluded
  • Logback logstash-structured-argument-attributes.included and logstash-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.included
  • otel.instrumentation.common.logging.structured-attributes.excluded
  • java.common.logging.structured_attributes.included
  • java.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.