Skip to content

.NET: Python: Avoid duplicate log export when root logger already has an OTel handler - #9897

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
droideronline:fix/otel-logging-handler-duplicate
Nov 3, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
droideronline:fix/otel-logging-handler-duplicate

Conversation

@droideronline

@droideronline Dineshsuriya D (droideronline) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

Issue #9896 reported that configure_otel_providers attaches an OTel LoggingHandler to the agent_framework logger, so an application that also has its own OTel LoggingHandler on the root logger exports every agent_framework record twice. Per maintainer direction on the issue, runtime behavior stays unchanged and the function's docstring is clarified instead.

Description & Review Guide

  • What are the major changes? Added a Note to the configure_otel_providers docstring: it is a convenience setup that attaches a handler to the agent_framework logger only, does not inspect or coordinate with other logging handlers, and applications combining it with their own root handler should use manual OpenTelemetry setup, with a pointer to python/samples/02-agents/observability/advanced_manual_setup_console_output.py. Also corrected an inline comment that said "root logger" where the code attaches to the agent_framework logger.
  • What is the impact of these changes? Documentation and a comment only. No runtime change.
  • What do you want reviewers to focus on? The wording of the new docstring note.

Related Issue

Fixes #9896

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: issue analysis and the docstring wording.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…docstring

Document that configure_otel_providers attaches its LoggingHandler to the agent_framework logger only and does not coordinate with the application's other logging handlers, and point to the manual setup sample. Also correct a comment that said root logger.
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net lab Usage: [Issues, PRs], Target: lab packages labels Nov 2, 2026
@droideronline
Dineshsuriya D (droideronline) force-pushed the fix/otel-logging-handler-duplicate branch from 8516750 to 5c6eb23 Compare November 2, 2026 17:42
@droideronline Dineshsuriya D (droideronline) changed the title Python: Avoid duplicate log export when root logger already has an OTel handler Python: Clarify configure_otel_providers logging handler behavior in docstring Nov 2, 2026
@github-actions github-actions Bot changed the title Python: Clarify configure_otel_providers logging handler behavior in docstring .NET: Python: Avoid duplicate log export when root logger already has an OTel handler Nov 2, 2026
Merged via the queue into microsoft:main with commit 91e49cd Nov 3, 2026
51 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 5c6eb233 Deployed Nov 2, 2026 by droideronline via add_label #26866
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs lab Usage: [Issues, PRs], Target: lab packages .NET Usage: [Issues, PRs], Target: .Net python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: configure_otel_providers duplicates log export when the app has a root OTel LoggingHandler

3 participants