qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] util/log: Always send errors to logfile when daemonized
@ 2022-10-19 15:16 Greg Kurz
  2022-10-19 15:16 ` [PATCH v2 1/2] util/log: Derive thread id from getpid() on hosts w/o gettid() syscall Greg Kurz
  2022-10-19 15:16 ` [PATCH v2 2/2] util/log: Always send errors to logfile when daemonized Greg Kurz
  0 siblings, 2 replies; 14+ messages in thread
From: Greg Kurz @ 2022-10-19 15:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Daniel P . Berrangé, Richard Henderson,
	Paolo Bonzini, Greg Kurz

When QEMU is started with `--daemonize -D ${logfile} -d ${some_log_item}`,
error logs from error_report() and friends go to ${logfile}, but if QEMU
is started with `-daemonize -D ${logfile}` and no `-d`, the file isn't
even created and all logs go to /dev/null.

This inconsistency is quite confusing for users and gives the impression
that QEMU doesn't log errors at all. It seems much saner to always create
the log file when `-D` was passed and to be able to report errors.

It was spotted by the kata-containers project, which happens to do just
that `--daemonize -D` without `-d` trick. It is possible that they will
stop doing so and catch errors through QEMU's stderr at some point, but
I'm posting the patches anyway.

v2:
- new log_thread_id() implementation for hosts without gettid() syscall
- avoid conflict between global log file and per-thread logfile
- style improvements

Greg Kurz (2):
  util/log: Derive thread id from getpid() on hosts w/o gettid() syscall
  util/log: Always send errors to logfile when daemonized

 util/log.c | 56 ++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 42 insertions(+), 14 deletions(-)

-- 
2.37.3




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-25  9:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 15:16 [PATCH v2 0/2] util/log: Always send errors to logfile when daemonized Greg Kurz
2022-10-19 15:16 ` [PATCH v2 1/2] util/log: Derive thread id from getpid() on hosts w/o gettid() syscall Greg Kurz
2022-10-19 15:57   ` Daniel P. Berrangé
2022-10-20  8:40     ` Greg Kurz
2022-10-20 10:39     ` Paolo Bonzini
2022-10-21 14:08       ` Greg Kurz
2022-10-19 15:16 ` [PATCH v2 2/2] util/log: Always send errors to logfile when daemonized Greg Kurz
2022-10-20  2:21   ` Richard Henderson
2022-10-20  9:49     ` Greg Kurz
2022-10-20  9:58       ` Daniel P. Berrangé
2022-10-20 10:52         ` Paolo Bonzini
2022-10-24  9:44           ` Alex Bennée
2022-10-25  8:52             ` Greg Kurz
2022-10-25  9:20             ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).