From 5f901f257f229b2551784c98243598eef322c15f Mon Sep 17 00:00:00 2001 From: Rajkumar Rangaraj Date: Wed, 11 Nov 2026 16:04:56 -0800 Subject: [PATCH 1/2] Use mdc-attributes.included instead of deprecated capture-mdc-attributes Avoids the SelectorConfig deprecation warning logged at every startup since OpenTelemetry Java Instrumentation 2.31. Also removes the log4j capture-context-data-attributes property which is no longer read upstream. Fixes #4890 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ .../agent/internal/init/AiConfigCustomizer.java | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cfba585e3..8e770d5e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +### Bug fixes + +* Fix startup deprecation warning for `capture-mdc-attributes` by using the replacement + `mdc-attributes.included` properties + ([#4890](https://github.com/microsoft/ApplicationInsights-Java/issues/4890)) + ## Version 3.7.10 GA (09/17/2026) ### Enhancements diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java index 393fb47666..395171ac63 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java @@ -66,12 +66,11 @@ public Map apply(ConfigProperties otelConfig) { // enable capturing all mdc properties properties.put( - "otel.instrumentation.logback-appender.experimental.capture-mdc-attributes", "*"); - properties.put("otel.instrumentation.log4j-appender.experimental.capture-mdc-attributes", "*"); + "otel.instrumentation.logback-appender.experimental.mdc-attributes.included", "*"); + // for log4j, this covers both MDC and context data + properties.put("otel.instrumentation.log4j-appender.experimental.mdc-attributes.included", "*"); properties.put( - "otel.instrumentation.log4j-appender.experimental.capture-context-data-attributes", "*"); - properties.put( - "otel.instrumentation.jboss-logmanager.experimental.capture-mdc-attributes", "*"); + "otel.instrumentation.jboss-logmanager.experimental.mdc-attributes.included", "*"); properties.put( "otel.instrumentation.log4j-appender.experimental.capture-map-message-attributes", "true"); From cf90a7462fe505e1a449c346d7fa4531d84091ff Mon Sep 17 00:00:00 2001 From: Rajkumar Rangaraj Date: Wed, 11 Nov 2026 16:05:17 -0800 Subject: [PATCH 2/2] Link changelog entry to PR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e770d5e71..bae3d00952 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Fix startup deprecation warning for `capture-mdc-attributes` by using the replacement `mdc-attributes.included` properties - ([#4890](https://github.com/microsoft/ApplicationInsights-Java/issues/4890)) + ([#4893](https://github.com/microsoft/ApplicationInsights-Java/pull/4893)) ## Version 3.7.10 GA (09/17/2026)