Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2016-02-11 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 11/02/2016 17:49, Dimitris Aragiorgis wrote: >> 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)

Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2016-02-11 Thread Dimitris Aragiorgis
Hi, * Paolo Bonzini [2016-02-11 13:31:17 +0100]: > > > 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 a

Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2016-02-11 Thread Paolo Bonzini
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

Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2016-02-11 Thread Dimitris Aragiorgis
Hi, * Paolo Bonzini [2016-02-08 10:29:55 +0100]: > > > On 16/12/2015 17:56, Alex Pyrgiotis wrote: > > + > > +log = qemu_get_log_filename(); > > +if (log != NULL) { > > +TFR(fd = qemu_open(log, O_RDWR | O_APPEND | O_CREAT, 0640)); > > Here you are opening the same f

Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2016-02-08 Thread Paolo Bonzini
On 16/12/2015 17:56, Alex Pyrgiotis wrote: > + > +log = qemu_get_log_filename(); > +if (log != NULL) { > +TFR(fd = qemu_open(log, O_RDWR | O_APPEND | O_CREAT, 0640)); Here you are opening the same file twice, but the FILE* that is opened in do_qemu_set_log does not ne

[Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize

2015-12-16 Thread Alex Pyrgiotis
From: Dimitris Aragiorgis In case of daemonize, use the logfile passed with the -D option in order to redirect stdout/stderr to a file instead of /dev/null. Signed-off-by: Dimitris Aragiorgis Signed-off-by: Alex Pyrgiotis diff --git a/include/qemu/log.h b/include/qemu/log.h index 362cbc4..b5d