mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-14 16:09:34 +00:00
Reloading the log config on SIGHUP writes every record back into Twisted's logging. `redirect_stdio_to_logs()` replaces `sys.stderr` with a `LoggingFile` after startup, and `_load_logging_config` then rebuilds `StreamHandler`s on it, so records hit the `logging during logging` guard in `one_time_logging_setup` and JSON lines get wrapped a second time. `dictConfig` now runs with `sys.__stdout__` and `sys.__stderr__` swapped in, and the redirected streams are put back afterwards, including when the config is invalid. `tests/config/test_logger.py` covers both. Not covered: Windows and configs that use a `FileHandler`. Fixes #20091 ### Pull Request Checklist * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (ruff check, ruff format and mypy run on the changed files)