mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-14 11:30:49 +00:00
Document the pyo3-log level cache in the logcontext debugging docs
Enabling synapse.logging.context.debug at runtime (e.g. from the manhole) silently misses the Rust-emitted enter/exit traces because pyo3-log caches logger levels; the cache is only flushed when the logging config is (re)loaded. Spell out the reset_logging_config() step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFbRtswu7rsHrttJFauUUb
This commit is contained in:
co-authored by
Claude Fable 5
parent
ddbbb84306
commit
88739cbbf4
@@ -592,3 +592,18 @@ loggers:
|
||||
synapse.logging.context.debug:
|
||||
level: DEBUG
|
||||
```
|
||||
|
||||
Note that some of these traces (`LoggingContext(...).__enter__`/`__exit__`) are
|
||||
emitted from Rust via `pyo3-log`, which caches logger levels for performance.
|
||||
Configuring the logger in the logging config (as above) works — the cache is
|
||||
flushed whenever the config is (re)loaded, including on `SIGHUP` — but enabling
|
||||
the logger *at runtime* (e.g. `setLevel(logging.DEBUG)` from the manhole) will
|
||||
not surface the Rust-emitted traces until you also flush the cache:
|
||||
|
||||
```python
|
||||
import logging
|
||||
from synapse.synapse_rust import reset_logging_config
|
||||
|
||||
logging.getLogger("synapse.logging.context.debug").setLevel(logging.DEBUG)
|
||||
reset_logging_config()
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user