summary refs log tree commit diff stats
path: root/include/hw/ide
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2022-11-08 15:00:32 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2023-01-06 00:50:32 +0100
commit9b063b7ea697d796914b3651d15c3457b7b1135c (patch)
tree705e7c196777f7310bc29955a0d859e2a8b0c6ea /include/hw/ide
parent59bde2137445b63c822720d069d91d38190c6540 (diff)
downloadfocaccia-qemu-9b063b7ea697d796914b3651d15c3457b7b1135c.tar.gz
focaccia-qemu-9b063b7ea697d796914b3651d15c3457b7b1135c.zip
util/log: Always send errors to logfile when daemonized
When QEMU is started with `-daemonize`, all stdio descriptors get
redirected to `/dev/null`. This basically means that anything
printed with error_report() and friends is lost.

Current logging code allows to redirect to a file with `-D` but
this requires to enable some logging item with `-d` as well to
be functional.

Relax the check on the log flags when QEMU is daemonized, so that
other users of stderr can benefit from the redirection, without the
need to enable unwanted debug logs. Previous behaviour is retained
for the non-daemonized case. The logic is unrolled as an `if` for
better readability. The qemu_log_level and log_per_thread globals
reflect the state we want to transition to at this point : use
them instead of the intermediary locals for correctness.

qemu_set_log_internal() is adapted to open a per-thread log file
when '-d tid' is passed. This is done by hijacking qemu_try_lock()
which seems simpler that refactoring the code.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <20221108140032.1460307-3-groug@kaod.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/hw/ide')
0 files changed, 0 insertions, 0 deletions