• Simon McVittie's avatar
    _dbus_logv: configurably log to syslog and/or stderr · 92bd5ef2
    Simon McVittie authored
    This changes the behaviour of _dbus_logv() if _dbus_init_system_log() was
    not called. Previously, _dbus_logv() would always log to syslog;
    additionally, it would log to stderr, unless the process is dbus-daemon
    and it was started by systemd. Now, it will log to stderr only,
    unless _dbus_init_system_log() was called first.
    This is the desired behaviour because when we hook up
    _dbus_warn_check_failed() to _dbus_logv() in the next commit, we don't
    want typical users of libdbus to start logging their check failures to
    syslog - we only want the dbus-daemon to do that.
    In practice this is not usually a behaviour change, because there was
    only one situation in which we called _dbus_logv() without first calling
    _dbus_init_system_log(), namely an error while parsing configuration
    files. Initialize the system log "just in time" in that situation
    to preserve existing behaviour.
    Signed-off-by: default avatarSimon McVittie <smcv@debian.org>
dbus-sysdeps.c 17.5 KB