Add configuration of log level and formatting for Auto Instrumentation#4203
Add configuration of log level and formatting for Auto Instrumentation#4203jeremydvoss wants to merge 11 commits intoopen-telemetry:mainfrom
Conversation
a0b79f8 to
e641e75
Compare
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
|
According to the specification, The logging config should only apply to the |
opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Outdated
Show resolved
Hide resolved
d8924e5 to
e7f0f9e
Compare
I see your point. I'll bring up in the next sig. Since this is a broader matter, I have also made an issue to make sure we tackle this before logging stability. |
|
Added tests. |
opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py
Outdated
Show resolved
Hide resolved
e7f0f9e to
526b640
Compare
d510c06 to
d996147
Compare
|
@roger-collins-self I switched to using OTEL_PYTHON_LOG_LEVEL instead of OTEL_LOG_LEVEL. This must by why the logging instrumentation does the same. |
|
Looks like there's some issue with Python 3.8. Will investigate. |
|
I don't understand this error. How might it be related to this change? |
|
https://markandruth.co.uk/2025/05/30/getting-opentelemetry-logging-working-in-python might be useful for some gotchas and workarounds while this PR is not yet merged. |
|
Hi @jeremydvoss I am looking to get some of this functionality that you previously worked on merged. I was hoping that using some of your previous changes in #4921 is ok? Thank you. |
Description
Proposal for adding configuration of log level and formatting for Auto Instrumentation. Main subject to decide on is which env vars to use:
OTEL_LOG_LEVEL: Exists in the SDK but unused. Speced out to be the level for the SDK's internal logger, not the LoggingHandler.
OTEL_PYTHON_LOG_LEVEL: Currently only used by Python Logging Instrumentation
OTEL_PYTHON_LOG_FORMAT: Currently only used by Python Logging Instrumentation
OTEL_PYTHON_LOG_HANDLER_LEVEL: Possible new env var that is clearer and does not map to the same --log_level flag as OTEL_LOG_LEVEL
Fixes #4034
Type of change
Please delete options that are not relevant.
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
Does This PR Require a Contrib Repo Change?
Checklist: