From: Zhou Yimin <zhouyimin(a)huawei.com>
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(a)huawei.com>
---
daemon/libvirtd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 4cf78e6..87af903 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -683,6 +683,12 @@ daemonSetupLogging(struct daemonConfig *config,
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
* to direct it to the systemd journal
@@ -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:
--
1.7.12.4