From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: groug@kaod.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH] util/log: do not close and reopen log files when flags are turned off
Date: Tue, 25 Oct 2022 20:30:26 +1000 [thread overview]
Message-ID: <43a73137-033c-4b20-8a03-3ddb88ed9e16@linaro.org> (raw)
In-Reply-To: <20221025092119.236224-1-pbonzini@redhat.com>
On 10/25/22 19:21, Paolo Bonzini wrote:
> log_append makes sure that if you turn off the logging (which clears
> log_flags and makes need_to_open_file false) the old log is not
> overwritten. The usecase is that if you remove or move the file
> QEMU will not keep writing to the old file. However, this is
> not always the desited behavior, in particular having log_append==1
> after changing the file name makes little sense.
>
> When qemu_set_log_internal is called from the logfile monitor
> command, filename must be non-NULL and therefore changed_name must
> be true. Therefore, the only case where the file is closed and
> need_to_open_file == false is indeed when log_flags becomes
> zero. In this case, just flush the file and do not bother
> closing it, thus faking the same append behavior as previously.
>
> The behavioral change is that changing the logfile twice, for
> example log1 -> log2 -> log1, will cause log1 to be overwritten.
> This can simply be documented, since it is not a particularly
> surprising behavior.
>
> Suggested-by: Alex Bennée<alex.bennee@linaro.org>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
> util/log.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2022-10-25 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 9:21 [PATCH] util/log: do not close and reopen log files when flags are turned off Paolo Bonzini
2022-10-25 10:30 ` Richard Henderson [this message]
2022-10-25 12:33 ` Greg Kurz
2022-10-25 14:38 ` Greg Kurz
2022-10-25 20:27 ` Paolo Bonzini
2022-10-26 6:27 ` Greg Kurz
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=43a73137-033c-4b20-8a03-3ddb88ed9e16@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--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).