Skip to content

Commit 562fb69

Browse files
committed
Apply more Pablo feedback
1 parent f11eedc commit 562fb69

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ def record_factory(*args, **kwargs):
225225
)
226226
if sdk_autoinstrumentation_env_var == "true":
227227
_logger.warning(
228-
"Disabling logging auto-instrumentation. If you have opentelemetry-instrumentation-logging "
229-
"you don't need to set `OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`"
228+
"Skipping installation of LoggingHandler from "
229+
"`opentelemetry-instrumentation-logging` to avoid duplicate logs. "
230+
"The SDK's deprecated LoggingHandler is already active "
231+
"(OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true). To migrate, unset "
232+
"this environment variable. The SDK's handler will be removed in a future release."
230233
)
231234
elif kwargs.get(
232235
"enable_log_auto_instrumentation",

instrumentation/opentelemetry-instrumentation-logging/tests/test_logging.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,10 @@ def test_handler_setup_is_disabled_if_sdk_autoinstrumentation_env_var_is_set_to_
284284
record = self.caplog.records[0]
285285
self.assertEqual(
286286
record.message,
287-
"Disabling logging auto-instrumentation. If you have opentelemetry-instrumentation-logging "
288-
"you don't need to set `OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`",
287+
"Skipping installation of LoggingHandler from `opentelemetry-instrumentation-logging` "
288+
"to avoid duplicate logs. The SDK's deprecated LoggingHandler is already "
289+
"active (OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true). To migrate, unset "
290+
"this environment variable. The SDK's handler will be removed in a future release.",
289291
)
290292

291293
root_logger = logging.getLogger()
@@ -383,7 +385,7 @@ def test_handler_setup_is_controlled_by_instrumentor_parameter(
383385
LoggingInstrumentor().uninstrument()
384386
with self.caplog.at_level(level=logging.WARNING):
385387
LoggingInstrumentor().instrument(
386-
enable_log_auto_istrumentation=False
388+
enable_log_auto_instrumentation=False
387389
)
388390

389391
self.assertEqual(len(self.caplog.records), 0)

0 commit comments

Comments
 (0)