apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00322
[Merge] apport:journal-errors-window into apport:main
Brian Murray has proposed merging apport:journal-errors-window into apport:main.
Requested reviews:
Benjamin Drung (bdrung)
For more details, see:
https://code.launchpad.net/~apport-hackers/apport/+git/apport/+merge/422775
--
Your team Apport upstream developers is subscribed to branch apport:main.
diff --git a/data/general-hooks/generic.py b/data/general-hooks/generic.py
index 6d885fc..74cf1b6 100644
--- a/data/general-hooks/generic.py
+++ b/data/general-hooks/generic.py
@@ -14,6 +14,7 @@
import os, re
import apport.hookutils, apport.fileutils
+from datetime import datetime, timedelta
def add_info(report, ui):
nm = apport.hookutils.nonfree_kernel_modules()
@@ -89,8 +90,18 @@ Do you want to continue the report process anyway?
# log errors
if report['ProblemType'] == 'Crash':
if os.path.exists('/run/systemd/system'):
- report['JournalErrors'] = apport.hookutils.command_output(
- ['journalctl', '-b', '--priority=warning', '--lines=1000'])
+ if 'Date' in report:
+ crash_time = datetime.strptime(report['Date'],
+ '%a %b %d %H:%M:%S %Y')
+ before_crash = crash_time - timedelta(seconds=10)
+ after_crash = crash_time + timedelta(seconds=10)
+ report['JournalErrors'] = apport.hookutils.command_output(
+ ['journalctl', '--priority=warning',
+ '--since=%s' % before_crash,
+ '--until=%s' % after_crash])
+ else:
+ report['JournalErrors'] = apport.hookutils.command_output(
+ ['journalctl', '-b', '--priority=warning', '--lines=1000'])
if __name__ == '__main__':
Follow ups