Skip to content

docs: update logs example to use opentelemetry-instrumentation-logging#5344

Open
avinab-neogy wants to merge 3 commits into
open-telemetry:mainfrom
avinab-neogy:docs/update-logging-sdk-readme
Open

docs: update logs example to use opentelemetry-instrumentation-logging#5344
avinab-neogy wants to merge 3 commits into
open-telemetry:mainfrom
avinab-neogy:docs/update-logging-sdk-readme

Conversation

@avinab-neogy

@avinab-neogy avinab-neogy commented Jun 23, 2026

Copy link
Copy Markdown

Description

Update the logs example documentation to reflect that LoggingHandler
has moved from the SDK to the contrib package.

Refs #4738

Changes made:

  • Add Installation section with correct pip installs including opentelemetry-instrumentation-logging
  • Add Run the Example section for better structure
  • Add note that LoggingHandler has moved to opentelemetry-instrumentation-logging (deprecated in opentelemetry-sdk: deprecate logging handler #4919)
  • Add propagate=True with explanation comment in example.py

Type of change

  • This change requires a documentation update

How Has This Been Tested?

  • Built docs locally with tox -e docs — build succeeded with no warnings
  • Ran tox -e spellcheck — passed
  • Verified rendered HTML output looks correct

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@avinab-neogy avinab-neogy requested a review from a team as a code owner June 23, 2026 13:49
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 23, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: avinab-neogy / name: avinab-neogy (0ddf26c)

OpenTelemetry Logs SDK
======================

.. warning::

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.

This is unrelated to the LoggingHandler

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry about that, I misread the issue scope. Having re-read #4738, the warning removal was out of scope, restored it. The PR now only documents the LoggingHandler move.

@github-project-automation github-project-automation Bot moved this to Reviewed PRs that need fixes in Python PR digest Jun 23, 2026
@xrmx

xrmx commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

I think your changes are not very relevant with #4738 but the changes regarding the LoggingHandler move are good

logger1 = logging.getLogger("myapp.area1")
logger2 = logging.getLogger("myapp.area2")

# Ensure log records propagate to root logger so the handler picks them up

@xrmx xrmx Jun 23, 2026

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.

Are these really needed? Would be nice to test the examples

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Tested this end to end with the collector, all 6 log records came through fine. I have added the explicit propagate=True based on this from #4738:

only the root logger is instrumented, so seen loggers must have propagate set to True

if you are loading logging settings with logging/.config.dictConfig, you must save the root loggers before applying dictConfig

Also tested locally that dictConfig with a root section does wipe the OTel handler completely. The explicit assignment is hence there as a reminder for users who might use dictConfig. Also happy to just keep it as a comment if you prefer.

@avinab-neogy avinab-neogy requested a review from xrmx June 25, 2026 05:46
@avinab-neogy avinab-neogy force-pushed the docs/update-logging-sdk-readme branch from 987a3af to 9258631 Compare June 25, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

2 participants