qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] util/log: Always send errors to logfile when daemonized
@ 2022-11-08 14:00 Greg Kurz
  2022-11-08 14:00 ` [PATCH v3 1/2] util/log: do not close and reopen log files when flags are turned off Greg Kurz
  2022-11-08 14:00 ` [PATCH v3 2/2] util/log: Always send errors to logfile when daemonized Greg Kurz
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kurz @ 2022-11-08 14:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P . Berrangé, Alex Bennée, Paolo Bonzini,
	Richard Henderson, 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.

v3:
- drop log_append (Paolo's patch)
- new approach : call qemu_log_trylock() from qemu_set_log_internal() in
  the per-thread case, instead of trying to special case the main thread

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 (1):
  util/log: Always send errors to logfile when daemonized

Paolo Bonzini (1):
  util/log: do not close and reopen log files when flags are turned off

 util/log.c | 84 +++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 58 insertions(+), 26 deletions(-)

-- 
2.38.1




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

end of thread, other threads:[~2022-11-09  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 14:00 [PATCH v3 0/2] util/log: Always send errors to logfile when daemonized Greg Kurz
2022-11-08 14:00 ` [PATCH v3 1/2] util/log: do not close and reopen log files when flags are turned off Greg Kurz
2022-11-08 14:00 ` [PATCH v3 2/2] util/log: Always send errors to logfile when daemonized Greg Kurz
2022-11-09  2:06   ` Richard Henderson

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).