Skip to content

Commit 59baf31

Browse files
hectorhdzgxrmx
andauthored
Update logger level to NOTSET in logs example (#4637)
* Update logger level to NOTSET in logs example * Add changelog --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
1 parent 9a68c94 commit 59baf31

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
([#4621](https://github.com/open-telemetry/opentelemetry-python/pull/4621))
2020
- Fix license field in pyproject.toml files
2121
([#4625](https://github.com/open-telemetry/opentelemetry-python/pull/4625))
22+
- Update logger level to NOTSET in logs example
23+
([#4637](https://github.com/open-telemetry/opentelemetry-python/pull/4637))
2224
- Logging API accepts optional `context`; deprecates `trace_id`, `span_id`, `trace_flags`.
2325
([#4597](https://github.com/open-telemetry/opentelemetry-python/pull/4597))
2426

docs/examples/logs/example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter))
3434
handler = LoggingHandler(level=logging.NOTSET, logger_provider=logger_provider)
3535

36+
# Set the root logger level to NOTSET to ensure all messages are captured
37+
logging.getLogger().setLevel(logging.NOTSET)
38+
3639
# Attach OTLP handler to root logger
3740
logging.getLogger().addHandler(handler)
3841

0 commit comments

Comments
 (0)