[systemd-devel] sd-daemon documentation vs syslog log levels and facilities

Lennart Poettering lennart at poettering.net
Thu Sep 1 12:20:21 PDT 2011

On Thu, 01.09.11 18:17, Albert Strasheim (fullung at gmail.com) wrote:

> Hello all
> We started using systemd's logging today, but the documentation
> tripped us up a bit and could perhaps be improved to help other users.
> The example in the sd-daemon manual page makes no mention of
> facilities.

Yupp, we want to deemphesize facilities a bit, since they are a bit
arbitrary and very limited in their vocabulary. Since the facility is
probably the same for all messages generated by a service it's also
kinda nice if this is configured once in the unit file instead of
individually for each message, i.e. with SyslogFacility=.

That all said you can actually prefix your lines with priorities which
include a facility value and we will honour that. SD_NOTICE and suchlike
won't be particularly useful then however.

> Thus we assumed that our logs would have the facility we configured in
> SyslogFacility of our .service and logged our messages with only a
> level, like in the example:

> fprintf(stderr, SD_NOTICE "Hello World!\n");

Rightly so.

> After lots of stracing, we finally discovered that if you do this,
> systemd uses the LOG_USER facility, instead of the one we configured
> in our .service file.

Yupp, that sounds like a bug, and I have fixed it now in git. Would be
cool if you could test this. We now honour SyslogFacility= which
defaults to LOG_DAEMON.

> The sd-daemon manual page should probably mention this, and maybe
> systemd could use the configured SyslogFacility if it detects that
> messages are being logged without a facility.

I am not sure we should emphasize the facility as a per-message
setting. Instead we should just make SyslogLevel= work, which I
hopefully just did with my fix.


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list