From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTvTi-0004jO-N6 for qemu-devel@nongnu.org; Thu, 11 Feb 2016 12:56:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTvTf-0006ns-Eb for qemu-devel@nongnu.org; Thu, 11 Feb 2016 12:56:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTvTf-0006nd-93 for qemu-devel@nongnu.org; Thu, 11 Feb 2016 12:56:27 -0500 References: <1450284981-10641-1-git-send-email-apyrgio@arrikto.com> <56B86013.1050504@redhat.com> <20160211121230.GB7256@arr> <56BC7F15.9090603@redhat.com> <20160211164919.GC7256@arr> From: Paolo Bonzini Message-ID: <56BCCB44.4060203@redhat.com> Date: Thu, 11 Feb 2016 18:56:20 +0100 MIME-Version: 1.0 In-Reply-To: <20160211164919.GC7256@arr> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dimitris Aragiorgis Cc: Alex Pyrgiotis , qemu-devel@nongnu.org -----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); >> 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? >> > > I guess the above snippet will go in do_qemu_set_log(), right? > > If true, we have to open the logfile even if the -d option is not > given. Right, but only if daemonize. > Besides that, log.c should become aware of daemonize. Yes. Paolo