From 0fdc14bc42a8af64a17454c42d25f5c037e95309 Mon Sep 17 00:00:00 2001 From: Benjamin S Wolf Date: Sun, 15 Dec 2024 13:29:56 -0800 Subject: [PATCH] Core: Deduplicate exception output (#4036) When running Generate.py, uncaught exceptions are logged once to a file and twice to the console due to keeping the original excepthook. We can avoid this by filtering the file log out of the stream handler. --- Utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utils.py b/Utils.py index 50adb18f42be..574c006b503d 100644 --- a/Utils.py +++ b/Utils.py @@ -534,7 +534,8 @@ def handle_exception(exc_type, exc_value, exc_traceback): sys.__excepthook__(exc_type, exc_value, exc_traceback) return logging.getLogger(exception_logger).exception("Uncaught exception", - exc_info=(exc_type, exc_value, exc_traceback)) + exc_info=(exc_type, exc_value, exc_traceback), + extra={"NoStream": exception_logger is None}) return orig_hook(exc_type, exc_value, exc_traceback) handle_exception._wrapped = True