From: Richard Henderson <richard.henderson@linaro.org>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v3 2/2] util/log: Always send errors to logfile when daemonized
Date: Wed, 9 Nov 2022 13:06:49 +1100 [thread overview]
Message-ID: <8da99147-5eb9-3b2b-44f5-64d29c610ca4@linaro.org> (raw)
In-Reply-To: <20221108140032.1460307-3-groug@kaod.org>
On 11/9/22 01:00, Greg Kurz wrote:
> 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>
> ---
> util/log.c | 72 ++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 53 insertions(+), 19 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
prev parent reply other threads:[~2022-11-09 2:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8da99147-5eb9-3b2b-44f5-64d29c610ca4@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).