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:
Erik Johnston
2026-07-16 15:30:47 +00:00
co-authored by Claude Fable 5
parent ddbbb84306
commit 88739cbbf4
+15
View File
@@ -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()
```