From: Greg Kurz <groug@kaod.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé " <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/2] util/log: Always send errors to logfile when daemonized
Date: Tue, 25 Oct 2022 10:52:40 +0200 [thread overview]
Message-ID: <20221025105240.18b43485@bahia> (raw)
In-Reply-To: <87wn8pa72j.fsf@linaro.org>
On Mon, 24 Oct 2022 10:44:11 +0100
Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
> <snip>
> >> If we want to connect stdout/err to something when daemonized
> >> then lets either have a dedicated option for that, or simply
> >> tell apps not to use -daemonize and to take care of daemonzing
> >> themselves, thus having full control over stdout/err. The latter
> >> is what libvirt uses, because we actually want stderr/out on a
> >> pipe, not a file, in order to enforce rollover.
> >
> > I would gladly get rid of -daemonize, unfortunately it has many users.
> > Adding further complication to it is not beautiful, but overall I
> > think Greg's patch does make sense. In particular I would continue
> > the refactoring by moving
> >
> >
> > /*
> > * If per-thread, filename contains a single %d that should be
> > * converted.
> > */
> > if (per_thread) {
> > fname = g_strdup_printf(filename, getpid());
> > } else {
> > fname = g_strdup(filename);
> > }
> >
> > return fopen(fname, log_append ? "a" : "w");
> >
> > to a new function that can be used in both qemu_log_trylock() and
> > qemu_set_log_internal(). (In fact this refactoring is a bugfix
> > because per-thread log files do not currently obey log_append).
>
> What is the use case for log_append. AFAICT it only ever applied if you
> did a dynamic set_log. Was it ever really used or should it be dropped
> as an excessive complication?
>
The use case seems to be able to temporarily disable logging,
which closes the log file, without loosing already logged stuff
when logging is re-enabled. QEMU not overwriting previous logs
from the same run is certainly a legitimate expectation from the
user.
Complexity mostly stems from the fact that the log file gets closed
when doing `log none` from the monitor. The logic is also a bit
inconsistent : initial open ensures that we go with a pristine log
file, but renaming the file from the monitor will gladly append
messages to a pre-existing unrelated file...
> From my point of view appending to an existing per-thread log is just
> going to cause confusion.
>
... and cause confusion all the same.
I'd rather leave the log file always open, except on renames,
and always open in truncating mode.
> >
> > Paolo
>
>
next prev parent reply other threads:[~2022-10-25 9:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2022-10-25 9:20 ` Paolo Bonzini
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=20221025105240.18b43485@bahia \
--to=groug@kaod.org \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).