qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Pranith Kumar <bobby.prani@gmail.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Markus Armbruster <armbru@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH] qemu-log: Open file for logging when specified
Date: Wed, 17 Jun 2015 14:33:25 +0200	[thread overview]
Message-ID: <55816915.1020704@redhat.com> (raw)
In-Reply-To: <1433946024-18439-1-git-send-email-bobby.prani@gmail.com>



On 10/06/2015 16:20, Pranith Kumar wrote:
> qemu-log defaults to stderr when there is no '-D' option mentioned on command
> line. When '-D' option is specified, we also need to specify '-d' option for it
> to use the specified logfile. When using monitor to enable logging this is
> troublesome since there will be no '-d' option because of which monitor dumps
> the logs to stderr.
> 
> Fix this by opening the log file when '-D' is specified on the command line.
> Also fix an ancient comment which does not hold true since changing location and
> log level has now been streamlined.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Luiz Capitulino <lcapitulino@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Peter Maydell <peter.maydell@linaro.org>
> ---
>  vl.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index d4b2d03..5f81ccc 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3845,17 +3845,14 @@ int main(int argc, char **argv, char **envp)
>          exit(0);
>      }
>  
> -    /* Open the logfile at this point, if necessary. We can't open the logfile
> -     * when encountering either of the logging options (-d or -D) because the
> -     * other one may be encountered later on the command line, changing the
> -     * location or level of logging.
> +    /* Open the logfile at this point and set the log mask if necessary.
>       */
> +    if (log_file) {
> +        qemu_set_log_filename(log_file);
> +    }
> +
>      if (log_mask) {
>          int mask;
> -        if (log_file) {
> -            qemu_set_log_filename(log_file);
> -        }
> -
>          mask = qemu_str_to_log_mask(log_mask);
>          if (!mask) {
>              qemu_print_log_usage(stdout);
> 

Good idea---also it is consistent with what user-mode emulation already
does.

Paolo

      reply	other threads:[~2015-06-17 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 14:20 [Qemu-devel] [RFC PATCH] qemu-log: Open file for logging when specified Pranith Kumar
2015-06-17 12:33 ` Paolo Bonzini [this message]

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=55816915.1020704@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=bobby.prani@gmail.com \
    --cc=lcapitulino@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).