Describe your environment
N/A
What happened?
#4112 introduced a regression and currently it is not possible to initialize integration without also calling logging.basicConfig() as described here:
https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/logging/logging.html#manually-calling-logging-basicconfig
To enable fields that link to tracking from logs we need to enable set_logging_format:
if set_logging_format:
record.otelSpanID = format(ctx.span_id, "016x")
record.otelTraceID = format(ctx.trace_id, "032x")
record.otelTraceSampled = ctx.trace_flags.sampled
But that option also calls logging.basicConfig() which is undesired if one has a specific configuration:
if set_logging_format:
log_format = kwargs.get(
"logging_format", environ.get(OTEL_PYTHON_LOG_FORMAT, None)
)
log_format = log_format or DEFAULT_LOGGING_FORMAT
log_level = kwargs.get(
"log_level", LEVELS.get(environ.get(OTEL_PYTHON_LOG_LEVEL))
)
log_level = log_level or logging.INFO
logging.basicConfig(format=log_format, level=log_level)
Steps to Reproduce
Enable loggin integration with set_logging_format=True
Expected Result
logging.basicConfig() is not called
Actual Result
logging.basicConfig() is called
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe your environment
N/A
What happened?
#4112 introduced a regression and currently it is not possible to initialize integration without also calling
logging.basicConfig()as described here:https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/logging/logging.html#manually-calling-logging-basicconfig
To enable fields that link to tracking from logs we need to enable
set_logging_format:But that option also calls
logging.basicConfig()which is undesired if one has a specific configuration:Steps to Reproduce
Enable loggin integration with
set_logging_format=TrueExpected Result
logging.basicConfig()is not calledActual Result
logging.basicConfig()is calledAdditional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.