Skip to content

Commit b9cadc0

Browse files
Update logs example re root logger (open-telemetry#4090)
1 parent 21f4a20 commit b9cadc0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Added py.typed file to top-level module ([#4084](https://github.com/open-telemetry/opentelemetry-python/pull/4084))
1111
- Drop Final annotation from Enum in semantic conventions
1212
([#4085](https://github.com/open-telemetry/opentelemetry-python/pull/4085))
13+
- Update log export example to not use root logger ([#4090](https://github.com/open-telemetry/opentelemetry-python/pull/4090))
1314

1415
## Version 1.26.0/0.47b0 (2024-07-25)
1516

docs/examples/logs/example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@
3636
# Attach OTLP handler to root logger
3737
logging.getLogger().addHandler(handler)
3838

39-
# Log directly
40-
logging.info("Jackdaws love my big sphinx of quartz.")
41-
4239
# Create different namespaced loggers
40+
# It is recommended to not use the root logger with OTLP handler
41+
# so telemetry is collected only for the application
4342
logger1 = logging.getLogger("myapp.area1")
4443
logger2 = logging.getLogger("myapp.area2")
4544

0 commit comments

Comments
 (0)