Opened 5 years ago

Closed 4 years ago

#13487 closed Bug Report - General (fixed)

python bindings do not support the systemd-journal logging option (--systemd-journal)

Reported by: Gary Buhrmaster Owned by: Bill Meek
Priority: minor Milestone: 31.0
Component: Bindings - Python Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In what probably should have been a (co-)requirement before committing the patches from #12663 the python bindings were never updated to support journal logging.

I will note that one may need to make the import of the systemd.journal library inside a try/except to handle non-Linux OS's (I have not checked if there is a dummy implementation on FreeBSD or MacOS or Windows, but would not be surprised if they do not exist there).

Attachments (2)

logging_systemd-journal_pull_request_182.path (9.8 KB) - added by rcrdnalor 5 years ago.
test_systemd_journal_argparse.py (1.1 KB) - added by rcrdnalor 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by rcrdnalor

comment:1 Changed 5 years ago by rcrdnalor

Python Bindings: Add logging to 'systemd-journal'.

This patch adds the option to log to 'systemd-journal' from MythTV's Python Bindings. ('--systemd-journal'). If the python module 'systemd.journal' is not available, and '--systemd-journal' is selected, the user will be informed by an exception ('MythError?').

Caution: Since the python package "python-systemd" may be not installed by default or is not available on the OS-platform (e.g.: Windows), this commit adds a 'weak' run-time dependency ("python-systemd")!

Additionally, it follows the generic conventions used by 'MythCommandLineParser?':

  • Logging to database is deactivated by default and can be activated by '--enable-dblog'. The command line option '--nodblog' is kept for legacy reasons.
  • Logging to 'logfile', 'logpath', 'syslog', 'systemd-journal' is mutually exclusive: The user will be informed if he tries to combine those options. Previously, the bindings used the last option and deactivate the others, without user notification.

Attached a patch against pull request 182 and a file showing its usage.

Please decide.

Changed 5 years ago by rcrdnalor

comment:2 Changed 4 years ago by Stuart Auchterlonie

Milestone: needs_triage31.0
Owner: changed from Raymond Wagner to Bill Meek
Status: newassigned

comment:3 Changed 4 years ago by Bill Meek

Status: assignedaccepted

comment:4 Changed 4 years ago by Roland Ernst <rcrernst@…>

Resolution: fixed
Status: acceptedclosed

In 0763e32999/mythtv:

Python Bindings: support --systemd-journal logging

Closes #13487

Signed-off-by: Bill Meek <billmeek@…>

Note: See TracTickets for help on using tickets.