From 2538af4b06c81bf331803c62a46eb6dca671cf00 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 15 Feb 2022 10:49:14 +0100 Subject: [PATCH] Add workaround for python bug to HAQueueHandler (#66541) --- homeassistant/util/logging.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index 9216993eb53..8dba52ebe9d 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -33,6 +33,15 @@ class HideSensitiveDataFilter(logging.Filter): class HomeAssistantQueueHandler(logging.handlers.QueueHandler): """Process the log in another thread.""" + def prepare(self, record: logging.LogRecord) -> logging.LogRecord: + """Prepare a record for queuing. + + This is added as a workaround for https://bugs.python.org/issue46755 + """ + record = super().prepare(record) + record.stack_info = None + return record + def handle(self, record: logging.LogRecord) -> Any: """ Conditionally emit the specified logging record.