Skip to content

Support OTEL_LOG_LEVEL for internal logger#5282

Open
hariharan077 wants to merge 3 commits into
open-telemetry:mainfrom
hariharan077:fix-otel-log-level
Open

Support OTEL_LOG_LEVEL for internal logger#5282
hariharan077 wants to merge 3 commits into
open-telemetry:mainfrom
hariharan077:fix-otel-log-level

Conversation

@hariharan077

@hariharan077 hariharan077 commented Jun 9, 2026

Copy link
Copy Markdown

Fixes #1059.

What changed

  • Configure the OpenTelemetry internal logger (opentelemetry) from OTEL_LOG_LEVEL during SDK setup.
  • Default unset, empty, and invalid values to INFO; invalid values also emit a warning.
  • Add regression coverage for configured, default, empty, invalid, and child-logger propagation behavior.

Verification

  • Reproduced the issue locally before the fix: OTEL_LOG_LEVEL=debug left the opentelemetry logger at NOTSET.
  • .tox/py310-test-opentelemetry-sdk/bin/python -m pytest opentelemetry-sdk/tests/test_configurator.py::TestInternalLogLevel
  • .tox/py310-test-opentelemetry-sdk/bin/python -m pytest opentelemetry-sdk/tests/test_configurator.py::TestConfigurator opentelemetry-sdk/tests/test_configurator.py::TestLoggingInit
  • .tox/py310-test-opentelemetry-sdk/bin/python -m pytest opentelemetry-sdk/tests/test_configurator.py
  • uv run ruff format --check opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py opentelemetry-sdk/tests/test_configurator.py
  • uv run ruff check opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py opentelemetry-sdk/tests/test_configurator.py
  • uv run tox -e py310-test-opentelemetry-sdk
  • uv run tox -e lint-opentelemetry-sdk
  • uv run towncrier build --draft --version Unreleased

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

@hariharan077 hariharan077 marked this pull request as ready for review June 9, 2026 06:11
@hariharan077 hariharan077 requested a review from a team as a code owner June 9, 2026 06:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 428b884e19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Map fatal, fatal2, fatal3, and fatal4 to logging.CRITICAL for the internal SDK logger.

Assisted-by: ChatGPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add support for OTEL_LOG_LEVEL env variable

2 participants