From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEvOY-0005Jp-GZ for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:12:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEvOS-0004n2-9y for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:12:22 -0400 Received: from [58.251.49.30] (port=40203 helo=mail.sangfor.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEvOQ-0004lE-NG for qemu-devel@nongnu.org; Wed, 06 Aug 2014 03:12:16 -0400 Date: Wed, 6 Aug 2014 15:00:50 +0800 From: "=?utf-8?B?WmhhbmcgSGFveXU=?=" References: <201407251442088727201@sangfor.com>, <874my5hh4s.fsf@linaro.org>, <201407251907132706648@sangfor.com>, <53D25991.3010001@suse.de>, <201407261028057289331@sangfor.com>, <53D7FB52.3080801@redhat.com>, , , <201408060923243574967@sangfor.com>, , <201408061141203393982@sangfor.com>, <87sila16m6.fsf@blackfin.pond.sub.org> Message-ID: <201408061500482622862@sangfor.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] =?utf-8?q?=5Bquestions=5D_about_qemu_log?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?B?TWFya3VzIEFybWJydXN0ZXI=?= Cc: =?utf-8?B?UGV0ZXIgQ3Jvc3Rod2FpdGU=?= , =?utf-8?B?QWxleCBCZW5uw6ll?= , =?utf-8?B?cWVtdS1kZXZlbA==?= , =?utf-8?B?V2lsbGlhbSBEYXVjaHk=?= , =?utf-8?B?QW5kcmVhc19Gw6RyYmVy?= >>>>>>> The output is on qemu's stderr. You are in control of what that >>>>>> stderr is. >>>>>> >>>>>> I don't get why we can configure >>>>>> -D /path/to/unique/file/name.log >>>>>> >>>>>> but we also have to redirect stderr (I didn't checked if the daemonize >>>>>> option was closing it). What's the purpose of this logfile option? >>>>>> >>>>> >>>>>Well -D will log to file only loggable (i.e. qemu_log()) information >>>>>(which has all sorts of options and switches). Stderr, is a little >>>>>more static and should in theory be limited to genuine errors. But if >>>>>you want a combined log of both you can simply omit -D to default >>>>>qemu_log output to stderr. This gives you a combined log that you can >>>>>redirect anywhere. To be honest, this is what I do as a matter of >>>>>course (2> foo rather than -D foo). >>>>> >>>> Maybe we can introduce a new qemu option to specify a error logfile >>>> where stderr be redirected, like below, >>>> DEF("elogfile", HAS_ARG, QEMU_OPTION_elogfile, \ >>>> "-elogfile logfile redirect stderr log to logfile(default >>>> /var/log/qemu/##.log)\n", >>>> QEMU_ARCH_ALL) >>>> STEXI >>>> @item -elogfile @var{logfile} >>>> @findex -elogfile >>>> redirect stderr in @var{logfile} >>>> ETEXI >>>> then we can set the error log file through qemu command, >>>> /var/log/qemu/##.log as default. >>>> >>> >>>This sounds out-of-scope for QEMU to me and makes a standard flow >>>non-standard. If prints are going to stderr where should be going >>>elsewhere they probably should be fixed. Do you have specific examples >>>of information going to stderr that you would rather go to a log (be >>>it an error log or something else?). >>> >> I use proxmox to manage vm, it dose not redirect qemu's stderr, and >> start vm with -daemonize option, >> so the error log disappeared. >> I want to redirect the error log of qemu to a specified logfile, if >> fault happened, I can use the error log to analyze the fault. >> >> And, why qemu output the error log to stderr instead of a error >> logfile which can be configure? > >Because the code is a mess in that regard. > >You don't fix that by redirecting stderr wholesale, because that just >adds to the mess. You fix it at the root, one ill-advised fprintf() at >a time, as Peter advises: > Sorry, I'm afraid I misunderstand what you mean, should I replace all of fprintf(stderr, ...) with qemu_log() ? or only some cases where stderr is used where qemu_log should be, as Perter advises? If so, should I still need to redirect the stderr to specified logfile in qemu's parent shell/process ? Thanks, Zhang Haoyu >[...] >>>>>There's plently of tree wide work to clean up the cases where stderr >>>>>is used where qemu_log should be. If you are finding that log >>>>>information is going to stderr instead of the log, patches would be >>>>>welcome. > >If you want to redirect stderr in the interim, do it in whatever runs >QEMU.