[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] fix: scanner: log traceback instead of print it



commit 0f33d3a4a5d21c00b1210148e624f7098d0ddf0e
Author: juga0 <juga@xxxxxxxxxx>
Date:   Tue Mar 26 13:28:34 2019 +0000

    fix: scanner: log traceback instead of print it
---
 sbws/core/scanner.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index fdb44eb..d3ed5b1 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -70,7 +70,7 @@ def dumpstacks():
     for thread_id, stack in sys._current_frames().items():
         log.critical("Thread: %s(%d)",
                      thread_id2name.get(thread_id, ""), thread_id)
-        log.critical(traceback.print_stack(stack))
+        log.critical(traceback.format_stack("".join(stack)))
     # If logging level is less than DEBUG (more verbose), start pdb so that
     # developers can debug the issue.
     if log.getEffectiveLevel() < logging.DEBUG:
@@ -635,8 +635,10 @@ def force_get_results(pending_results):
             log.critical(FILLUP_TICKET_MSG)
             # If the exception happened in the threads, `log.exception` does
             # not have the traceback.
-            log.warning("traceback %s",
-                        traceback.print_exception(type(e), e, e.__traceback__))
+            # Using `format_exception` instead of of `print_exception` to show
+            # the traceback in all the log handlers.
+            log.warning("".join(traceback.format_exception(
+                        type(e), e, e.__traceback__)))
 
 
 def run_speedtest(args, conf):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits