Skip to content

Comments

opentelemetry-sdk: depcreate logging handler#4919

Open
xrmx wants to merge 6 commits intoopen-telemetry:mainfrom
xrmx:rework-logging-handler
Open

opentelemetry-sdk: depcreate logging handler#4919
xrmx wants to merge 6 commits intoopen-telemetry:mainfrom
xrmx:rework-logging-handler

Conversation

@xrmx
Copy link
Contributor

@xrmx xrmx commented Feb 17, 2026

Description

Deprecate using the SDK logging handler, suggest to use opentelemetry-instrumentation-logging instead. While at it also fix tests leaking handlers in loggers that affected other tests.

Refs #4330

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

@xrmx
Copy link
Contributor Author

xrmx commented Feb 19, 2026

Tests are failing because I'm using warnings.deprecated that is not available in older Python versions.

xrmx added 6 commits February 23, 2026 17:00
Move config handling to opentelemetry-instrumentation and the handler to
opentelemetry-instrumentation-logging
While at it also fix the noopprovider test case that was working because
we were asserting against another handler.
@xrmx xrmx force-pushed the rework-logging-handler branch from a2fed31 to 4139bf5 Compare February 23, 2026 16:16
@xrmx xrmx marked this pull request as ready for review February 23, 2026 16:19
@xrmx xrmx requested a review from a team as a code owner February 23, 2026 16:19
@tammy-baylis-swi tammy-baylis-swi moved this to Ready for review in @xrmx's Python PR digest Feb 23, 2026
Copy link
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

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

Hi Riccardo, changes LGTM. Suggested a couple of grammar tweaks in the warnings.

Comment on lines +330 to +332
"Setting the OTel Logging handler from the SDK and the "
"`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED` are deprecated. "
"You should install the opentelemetry-instrumentation-logging",
Copy link
Member

Choose a reason for hiding this comment

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

"The `OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED` environment"
" variable and the `LoggingHandler` in `opentelemetry-sdk` that it controls are"
" deprecated. Install the `opentelemetry-instrumentation-logging`"
" package instead.",

self._logger_provider = logger_provider or get_logger_provider()

warnings.warn(
"This is deprecated you should use the one in opentelemetry-instrumentation-logging",
Copy link
Member

Choose a reason for hiding this comment

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

"`LoggingHandler` in `opentelemetry-sdk` is deprecated. Use the"
" handler from `opentelemetry-instrumentation-logging` instead.",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants