]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
daemon: Fix option -v missing info priority log
authorZhou Yimin <zhouyimin@huawei.com>
Mon, 25 Aug 2014 12:18:01 +0000 (20:18 +0800)
committerJán Tomko <jtomko@redhat.com>
Mon, 25 Aug 2014 14:40:20 +0000 (16:40 +0200)
Introduce by 63fbcc692.

When start libvirtd with commandline "/usr/sbin/libvirtd -d -l -v",
we expect verbose(info level) log if neither environment variable
nor config file about logging controls is set. But in fact we can't
get any info priority log in the default output file.

The log priority of default output is VIR_LOG_DEFAULT(VIR_LOG_WARN),
so the info log is filtered out.
To record info priority log we must parse option -v before setting the
default output.

After this patch, we get all verbose log in the default output file.

Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
daemon/libvirtd.c

index 4cf78e6d81272c78ea7f6f29d44d06b63d5f94bd..87af9038f95c6bd039b7b6ab91488879f7625c62 100644 (file)
@@ -682,6 +682,12 @@ daemonSetupLogging(struct daemonConfig *config,
     if (virLogGetNbOutputs() == 0)
         virLogParseOutputs(config->log_outputs);
 
+    /*
+     * Command line override for --verbose
+     */
+    if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO))
+        virLogSetDefaultPriority(VIR_LOG_INFO);
+
     /*
      * If no defined outputs, and either running
      * as daemon or not on a tty, then first try
@@ -748,12 +754,6 @@ daemonSetupLogging(struct daemonConfig *config,
         VIR_FREE(tmp);
     }
 
-    /*
-     * Command line override for --verbose
-     */
-    if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO))
-        virLogSetDefaultPriority(VIR_LOG_INFO);
-
     return 0;
 
  error: