Cause the custom exception handler to also log unhandled exceptions'
authorScott Gasch <[email protected]>
Fri, 8 Apr 2022 13:54:04 +0000 (06:54 -0700)
committerScott Gasch <[email protected]>
Fri, 8 Apr 2022 13:54:04 +0000 (06:54 -0700)
tracebacks.

bootstrap.py

index 117468623b94e578894561d0ff6fede8a9a33135..a4923b4a9ce3424b80475c801dde8f93ed49b48f 100644 (file)
@@ -98,9 +98,15 @@ def handle_uncaught_exception(exc_type, exc_value, exc_tb):
             ORIGINAL_EXCEPTION_HOOK(exc_type, exc_value, exc_tb)
         else:
             # a terminal is attached and stderr is not redirected, maybe debug.
+            import io
             import traceback
 
-            traceback.print_exception(exc_type, exc_value, exc_tb)
+            tb_output = io.StringIO()
+            traceback.print_tb(exc_tb, None, tb_output)
+            print(tb_output.getvalue(), file=sys.stderr)
+            logger.error(tb_output.getvalue())
+            tb_output.close()
+
             if config.config['debug_unhandled_exceptions']:
                 import pdb