Преглед изворни кода

HUE-7447 [core] Add thread stack traces to debug log

Romain Rigaux пре 8 година
родитељ
комит
7ba5a09
2 измењених фајлова са 6 додато и 6 уклоњено
  1. 1 1
      desktop/core/src/desktop/lib/thread_util.py
  2. 5 5
      desktop/core/src/desktop/views.py

+ 1 - 1
desktop/core/src/desktop/lib/thread_util.py

@@ -41,7 +41,7 @@ def dump_traceback(file=sys.stderr, all_threads=True):
       name = "Current thread"
     else:
       name = "Thread"
-    
+
     trace_buffer = StringIO.StringIO()
     print >> trace_buffer, "%s: %s %s %s (most recent call last):" % (socket.gethostname(), name, thread.name, thread.ident)
     frame = sys._current_frames()[thread.ident]

+ 5 - 5
desktop/core/src/desktop/views.py

@@ -278,18 +278,18 @@ def dump_config(request):
 
 @access_log_level(logging.WARN)
 def threads(request):
-  """Dumps out server threads.  Useful for debugging."""
-  if not request.user.is_superuser:
-    return HttpResponse(_("You must be a superuser."))
-
+  """Dumps out server threads. Useful for debugging."""
   out = StringIO.StringIO()
   dump_traceback(file=out)
 
+  if not request.user.is_superuser:
+    return HttpResponse(_("You must be a superuser."))
+
   return HttpResponse(out.getvalue(), content_type="text/plain")
 
 @access_log_level(logging.WARN)
 def memory(request):
-  """Dumps out server threads.  Useful for debugging."""
+  """Dumps out server threads. Useful for debugging."""
   if not request.user.is_superuser:
     return HttpResponse(_("You must be a superuser."))