Log to journald

I created a very tiny logging function for shell and bash to log into the journal. Since it may be updated, I created a GitHub Gist out of it.

Further reading

The journald-cat man page.

Log from Python to journald

In Python it is as easy, just import journal from systemd

from systemd import journal
journal.send('Hello world')
journal.send("Hi", MESSAGE_ID="me", PRIORITY=1)

And of course it is possible to use it together with the logging system

log.addHandler(JournalHandler())