All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Ján Tomko" <jtomko@redhat.com>
Cc: qemu-devel@nongnu.org, Dimitris Aragiorgis <dimara@arrikto.com>
Subject: Re: [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized
Date: Mon, 29 Feb 2016 11:17:25 +0100	[thread overview]
Message-ID: <56D41AB5.2030803@redhat.com> (raw)
In-Reply-To: <20160229100406.GA3325@dnr.brq.redhat.com>



On 29/02/2016 11:04, Ján Tomko wrote:
> On Mon, Feb 29, 2016 at 10:07:47AM +0100, Paolo Bonzini wrote:
>>
>>
>> On 29/02/2016 09:57, Ján Tomko wrote:
>>> qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -M none
>>>  -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait
>>>  -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize
>>
>> Can you test this patch?
>>
>> diff --git a/util/log.c b/util/log.c
>> index 4dff00b..9402880 100644
>> --- a/util/log.c
>> +++ b/util/log.c
>> @@ -56,7 +56,8 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
>>  #ifdef CONFIG_TRACE_LOG
>>      qemu_loglevel |= LOG_TRACE;
>>  #endif
>> -    if ((qemu_loglevel || is_daemonized()) && !qemu_logfile) {
>> +    if (!qemu_logfile &&
>> +        (qemu_loglevel || (is_daemonized() && logfilename)) {
>>          if (logfilename) {
>>              qemu_logfile = fopen(logfilename, log_append ? "a" : "w");
>>              if (!qemu_logfile) {
>>
>> Thanks,
> 
> Still hangs,
> 
> (gdb) list
> 54      {
> 55          qemu_loglevel = log_flags;
> 56      #ifdef CONFIG_TRACE_LOG
> 57          qemu_loglevel |= LOG_TRACE;
> 58      #endif
> 59          sleep(10);
> 60          if (!qemu_logfile &&
> 61              (qemu_loglevel || (is_daemonized() && logfilename))) {
> 62              if (logfilename) {
> 63                  qemu_logfile = fopen(logfilename, log_append ? "a" : "w");
> (gdb) p qemu_logfile
> $1 = (FILE *) 0x0
> (gdb) p qemu_loglevel
> $2 = 32768
> (gdb) p logfilename
> $3 = 0x0
> (gdb) call is_daemonized()
> $4 = true

Second attempt:

diff --git a/util/log.c b/util/log.c
index 4dff00b..1530a60 100644
--- a/util/log.c
+++ b/util/log.c
@@ -56,7 +56,8 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
 #ifdef CONFIG_TRACE_LOG
     qemu_loglevel |= LOG_TRACE;
 #endif
-    if ((qemu_loglevel || is_daemonized()) && !qemu_logfile) {
+    if (!qemu_logfile &&
+        (is_daemonized() ? logfilename : qemu_loglevel)) {
         if (logfilename) {
             qemu_logfile = fopen(logfilename, log_append ? "a" : "w");
             if (!qemu_logfile) {
@@ -72,6 +73,7 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
             }
         } else {
             /* Default to stderr if no log file specified */
+            assert(!is_daemonized());
             qemu_logfile = stderr;
         }
         /* must avoid mmap() usage of glibc by setting a buffer "by hand" */


Paolo

  reply	other threads:[~2016-02-29 10:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 13:27 [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 01/19] qemu-options.hx: Improve documentation of chardev multiplexing mode Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 02/19] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 03/19] dump-guest-memory: cleanup: removing dump_{error|cleanup}() Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 05/19] dump-guest-memory: using static DumpState, add DumpStatus Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 07/19] dump-guest-memory: introduce dump_process() " Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 08/19] dump-guest-memory: disable dump when in INMIGRATE state Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 09/19] dump-guest-memory: add "detach" support Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 10/19] DumpState: adding total_size and written_size fields Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 11/19] Dump: add qmp command "query-dump" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 12/19] Dump: add hmp command "info dump" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 13/19] dump-guest-memory: add qmp event DUMP_COMPLETED Paolo Bonzini
2016-02-24 15:54   ` Eric Blake
2016-02-24 13:27 ` [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized Paolo Bonzini
2016-02-29  8:57   ` Ján Tomko
2016-02-29  9:07     ` Paolo Bonzini
2016-02-29 10:04       ` Ján Tomko
2016-02-29 10:17         ` Paolo Bonzini [this message]
2016-02-29 11:05           ` Ján Tomko
2016-02-29 11:17             ` Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 15/19] exec: store RAMBlock pointer into memory region Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 16/19] memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 17/19] memory: Remove unreachable return statement Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 18/19] chardev: Properly initialize ChardevCommon components Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 19/19] target-i386: fix confusion in xcr0 bit position vs. mask Paolo Bonzini
2016-02-25 10:45 ` [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Peter Maydell
2016-02-25 11:10   ` Gonglei (Arei)

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=56D41AB5.2030803@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dimara@arrikto.com \
    --cc=jtomko@redhat.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.