setroubleshoot/0002-framework-Log-plugin-e...

41 lines
1.3 KiB
Diff

From fc7aad6d9df91eba2445eac53e09372d844f5fd3 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Sat, 11 Jan 2020 20:34:22 +0100
Subject: [PATCH] framework: Log plugin exception traceback when log level is
DEBUG
Use the following setting to enable traceback logging when there's a 'Plugin
Exception'.
/etc/setroubleshoot/setroubleshoot.conf:
[sealert_log]
level = debug
---
framework/src/setroubleshoot/analyze.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/framework/src/setroubleshoot/analyze.py b/framework/src/setroubleshoot/analyze.py
index e16a47a3791f..43b2484be353 100644
--- a/framework/src/setroubleshoot/analyze.py
+++ b/framework/src/setroubleshoot/analyze.py
@@ -33,6 +33,7 @@ from gi.repository import GObject, GLib
import os
import time
import threading
+import traceback
from stat import *
import sys
from functools import cmp_to_key
@@ -213,6 +214,8 @@ class Analyze(object):
except Exception as e:
print(e, file=sys.stderr)
syslog.syslog(syslog.LOG_ERR, "Plugin Exception %s " % plugin.analysis_id)
+ (v1, v2, v3) = sys.exc_info()
+ log_debug(join(traceback.format_tb(v3)))
self.plugins.remove(plugin)
report_receiver.report_problem(siginfo)
--
2.25.1