Add systemd journal logging patch
Prints QEMU errors that occur *after* the "-daemonize" fork to the systemd journal, instead of pushing them into /dev/null like before. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
46c0ec19ad
commit
437d68473c
1
debian/control
vendored
1
debian/control
vendored
@ -25,6 +25,7 @@ Build-Depends: autotools-dev,
|
||||
libseccomp-dev,
|
||||
libspice-protocol-dev (>= 0.12.14~),
|
||||
libspice-server-dev (>= 0.14.0~),
|
||||
libsystemd-dev,
|
||||
libusb-1.0-0-dev (>= 1.0.17-1),
|
||||
libusbredirparser-dev (>= 0.6-2),
|
||||
python3-minimal,
|
||||
|
50
debian/patches/pve/0050-PVE-redirect-stderr-to-journal-when-daemonized.patch
vendored
Normal file
50
debian/patches/pve/0050-PVE-redirect-stderr-to-journal-when-daemonized.patch
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Reiter <s.reiter@proxmox.com>
|
||||
Date: Tue, 30 Jun 2020 13:10:10 +0200
|
||||
Subject: [PATCH] PVE: redirect stderr to journal when daemonized
|
||||
|
||||
QEMU uses the logging for error messages usually, so LOG_ERR is most
|
||||
fitting.
|
||||
---
|
||||
Makefile.objs | 1 +
|
||||
os-posix.c | 7 +++++--
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile.objs b/Makefile.objs
|
||||
index b7d58e592e..105f23bff7 100644
|
||||
--- a/Makefile.objs
|
||||
+++ b/Makefile.objs
|
||||
@@ -55,6 +55,7 @@ common-obj-y += net/
|
||||
common-obj-y += qdev-monitor.o
|
||||
common-obj-$(CONFIG_WIN32) += os-win32.o
|
||||
common-obj-$(CONFIG_POSIX) += os-posix.o
|
||||
+os-posix.o-libs := -lsystemd
|
||||
|
||||
common-obj-$(CONFIG_LINUX) += fsdev/
|
||||
|
||||
diff --git a/os-posix.c b/os-posix.c
|
||||
index 3cd52e1e70..ab4d052c62 100644
|
||||
--- a/os-posix.c
|
||||
+++ b/os-posix.c
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <libgen.h>
|
||||
+#include <systemd/sd-journal.h>
|
||||
+#include <syslog.h>
|
||||
|
||||
#include "qemu-common.h"
|
||||
/* Needed early for CONFIG_BSD etc. */
|
||||
@@ -309,9 +311,10 @@ void os_setup_post(void)
|
||||
|
||||
dup2(fd, 0);
|
||||
dup2(fd, 1);
|
||||
- /* In case -D is given do not redirect stderr to /dev/null */
|
||||
+ /* In case -D is given do not redirect stderr to journal */
|
||||
if (!qemu_logfile) {
|
||||
- dup2(fd, 2);
|
||||
+ int journal_fd = sd_journal_stream_fd("QEMU", LOG_ERR, 0);
|
||||
+ dup2(journal_fd, 2);
|
||||
}
|
||||
|
||||
close(fd);
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -48,3 +48,4 @@ pve/0046-pbs-fix-missing-crypt-and-compress-parameters.patch
|
||||
pve/0047-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch
|
||||
pve/0048-PVE-add-zero-block-handling-to-PBS-dump-callback.patch
|
||||
pve/0049-PVE-add-query-pbs-bitmap-info-QMP-call.patch
|
||||
pve/0050-PVE-redirect-stderr-to-journal-when-daemonized.patch
|
||||
|
Loading…
Reference in New Issue
Block a user