• E
    virlog: Introduce virLog{Get,Set}DefaultOutput · ae06048b
    Erik Skultety 提交于
    These helpers will manage the log destination defaults (fetch/set). The reason
    for this is to stay consistent with the current daemon's behaviour with respect
    to /etc/libvirt/<daemon>.conf file, since both assignment of an empty string
    or not setting the log output variable at all trigger the daemon's decision on
    the default log destination which depends on whether the daemon runs daemonized
    or not.
    This patch also changes the logic of the selection of the default
    logging output compared to how it is done now. The main difference though is
    that we should only really care if we're running daemonized or not, disregarding
    the fact of (not) having a TTY completely (introduced by commit eba36a38) as
    that should be of the libvirtd's parent concern (what FD it will pass to it).
    
     Before:
     if (godaemon || !hasTTY):
         if (journald):
             use journald
    
     if (godaemon):
         if (privileged):
             use SYSCONFIG/libvirtd.log
         else:
             use XDG_CONFIG_HOME/libvirtd.log
     else:
         use stderr
    
     After:
     if (godaemon):
         if (journald):
             use journald
    
         else:
             if (privileged):
                 use SYSCONFIG/libvirtd.log
             else:
                 use XDG_CONFIG_HOME/libvirtd.log
     else:
         use stderr
    Signed-off-by: NErik Skultety <eskultet@redhat.com>
    ae06048b
virlog.c 50.1 KB