[systemd-devel] Journald logging handler for Python 3 and AsyncIO integration
zbyszek at in.waw.pl
Sat May 2 07:47:13 PDT 2015
On Sat, May 02, 2015 at 04:31:44PM +0200, Ludovic Gasc wrote:
> 2015-05-02 16:18 GMT+02:00 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>:
> > On Sat, May 02, 2015 at 03:34:52PM +0200, Ludovic Gasc wrote:
> > > Ok, my bad, I didn't see JournalHandler class to use with Python logging:
> > >
> > http://www.freedesktop.org/software/systemd/python-systemd/journal.html#journalhandler-class
> > >
> > > Nevertheless, my question about communication between Python and journald
> > > remains.
> > Can you rephrase the question? I don't quite understand what functionality
> > you're missing from
> > http://www.freedesktop.org/software/systemd/python-systemd/journal.html#systemd.journal.send
> > .
> In AsyncIO, when you interact with the outside world, you need to use
> "yield from", for example:
> "yield from" means to the Python interpreter to "pause" the coroutine to
> work on another coroutine until data arrive.
> To be efficient, I/O should handled by AsyncIO, even if some workarounds
> are possible if the raw socket isn't accessible.
> If this pattern is useful for HTTP requests, for logging where you
> shouldn't wait a return, it isn't very critical, especially if you use
> syslog protocol with UNIX socket.
> Nevertheless, to be sure, I wish to understand how the communication works
> between my process and journald daemon.
systemd.journal.send is a thin wrapper around sd_journal_send, which calls sd_journal_sendv,
which uses sendmsg() to send to a unix socket at /run/systemd/journal/socket.
You can see the sources at
More information about the systemd-devel