From: Paolo Bonzini <pbonzini@redhat.com>
To: Dimitris Aragiorgis <dimara@arrikto.com>
Cc: Alex Pyrgiotis <apyrgio@arrikto.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize
Date: Thu, 11 Feb 2016 13:31:17 +0100 [thread overview]
Message-ID: <56BC7F15.9090603@redhat.com> (raw)
In-Reply-To: <20160211121230.GB7256@arr>
On 11/02/2016 13:12, Dimitris Aragiorgis wrote:
> Besides that, when one executes a daemon, shell redirection is
> hardly, if ever, used. More so if the daemon already has a logfile
> option.
>
> So, we decided to give it a go and find the least painful way to
> log the stderr of a QEMU process to a logfile.
>
> To our understanding, the logfile (-D option) is used only for
> messages generated by qemu_log()/qemu_log_mask(). The current
> situation however is that fprintf(stderr, ...) is used in various
> places throughout the codebase for logging/debug purposes.
Right, mostly through error_report.
Actually I like your approach (log to -D if daemonize is used). I
just was not sure of the best way to implement it.
Perhaps when the logfile is opened you can replace the straight fopen with
qemu_logfile = fopen(...);
if (daemonized) {
dup2(fileno(qemu_logfile), STDERR_FILENO);
fclose(qemu_logfile);
qemu_logfile = stderr;
}
Then the logfile will never be closed by qemu_log_close, and stderr
will always be sent to it. Does this look sane?
Paolo
next prev parent reply other threads:[~2016-02-11 12:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 16:56 [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize Alex Pyrgiotis
2016-02-08 9:29 ` Paolo Bonzini
2016-02-11 12:12 ` Dimitris Aragiorgis
2016-02-11 12:31 ` Paolo Bonzini [this message]
2016-02-11 16:49 ` Dimitris Aragiorgis
2016-02-11 17:56 ` Paolo Bonzini
2016-02-18 11:38 ` [Qemu-devel] [PATCH] log: Redirect stderr to logfile if deamonized Dimitris Aragiorgis
2016-02-18 15:22 ` Paolo Bonzini
2016-02-18 17:12 ` Dimitris Aragiorgis
2016-02-19 17:25 ` Paolo Bonzini
2016-03-01 11:15 ` Gerd Hoffmann
2016-03-01 11:47 ` Daniel P. Berrange
2016-03-01 11:51 ` Paolo Bonzini
2016-03-01 11:58 ` Daniel P. Berrange
2016-03-01 12:03 ` Paolo Bonzini
2016-03-01 13:54 ` Daniel P. Berrange
2016-03-01 11:50 ` 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=56BC7F15.9090603@redhat.com \
--to=pbonzini@redhat.com \
--cc=apyrgio@arrikto.com \
--cc=dimara@arrikto.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.