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 <zbys...@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: > https://docs.python.org/3/library/asyncio-stream.html#tcp-echo-client-using-streams > > "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 http://cgit.freedesktop.org/systemd/systemd/tree/src/journal/journal-send.c?id=HEAD#n199.
Zbyszek _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel