mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 14:33:10 +00:00
util: Fix the default log output to 'journald' when running under systemd
Essentially, bring back the old behaviour as of commiteba36a38
which was later changed by commitae06048bf5
. Even though all the stderr messages will eventually end up in the journal, we're not making use of the fields journald provides. https://bugzilla.redhat.com/show_bug.cgi?id=1592644 Signed-off-by: Erik Skultety <eskultet@redhat.com> Acked-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f3a4fbd24b
commit
30727583ae
@ -223,11 +223,17 @@ virLogSetDefaultOutputToFile(const char *filename, bool privileged)
|
|||||||
int
|
int
|
||||||
virLogSetDefaultOutput(const char *filename, bool godaemon, bool privileged)
|
virLogSetDefaultOutput(const char *filename, bool godaemon, bool privileged)
|
||||||
{
|
{
|
||||||
if (!godaemon)
|
bool have_journald = access("/run/systemd/journal/socket", W_OK) >= 0;
|
||||||
return virLogSetDefaultOutputToStderr();
|
|
||||||
|
|
||||||
if (access("/run/systemd/journal/socket", W_OK) >= 0)
|
if (godaemon) {
|
||||||
return virLogSetDefaultOutputToJournald();
|
if (have_journald)
|
||||||
|
return virLogSetDefaultOutputToJournald();
|
||||||
|
} else {
|
||||||
|
if (!isatty(STDIN_FILENO) && have_journald)
|
||||||
|
return virLogSetDefaultOutputToJournald();
|
||||||
|
|
||||||
|
return virLogSetDefaultOutputToStderr();
|
||||||
|
}
|
||||||
|
|
||||||
return virLogSetDefaultOutputToFile(filename, privileged);
|
return virLogSetDefaultOutputToFile(filename, privileged);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user