Skip to content

Commit 23ca5a3

Browse files
Fix incorrect Logs example in instrumentation.md (#8503)
1 parent edf9b8e commit 23ca5a3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

content/en/docs/languages/python/instrumentation.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,18 @@ log records that OpenTelemetry can process.
406406
import logging
407407
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
408408
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor, ConsoleLogExporter
409-
from opentelemetry._logs import set_logger_provider, get_logger
409+
from opentelemetry._logs import set_logger_provider
410410

411411
provider = LoggerProvider()
412412
processor = BatchLogRecordProcessor(ConsoleLogExporter())
413413
provider.add_log_record_processor(processor)
414414
# Sets the global default logger provider
415415
set_logger_provider(provider)
416416

417-
logger = get_logger(__name__)
418-
419417
handler = LoggingHandler(level=logging.INFO, logger_provider=provider)
420418
logging.basicConfig(handlers=[handler], level=logging.INFO)
421419

422-
logging.info("This is an OpenTelemetry log record!")
420+
logging.getLogger(__name__).info("This is an OpenTelemetry log record!")
423421
```
424422

425423
### Further Reading

0 commit comments

Comments
 (0)