+Mon Dec 22 17:13:42 CET 2008 Daniel Veillard <veillard@redhat.com>
+
+ * qemud/qemud.c qemud/test_libvirtd_qemu.aug tests/Makefile.am
+ tests/daemon-conf: fix make check with the new logging support
+ the messages now carry a timestamp which need to be removed,
+ the daemon needs to exit if the log configuration informations
+ are wrong and we also look at the LIBVIRT_DEBUG environment
+ variable
+
Mon Dec 22 14:07:29 CET 2008 Daniel Veillard <veillard@redhat.com>
* qemud/mdns.c: fix a compilation problem in the switch
* is also saved onto the logfile libvird.log, but if verbose or error
* debugging is asked for then output informations or debug.
*/
-static void
+static int
qemudSetLogging(virConfPtr conf, const char *filename) {
+ char *debugEnv;
+ int ret = -1;
+
virLogReset();
- /* look for default logging level */
+ /*
+ * look for default logging level first from config file,
+ * then from environment variable and finally from command
+ * line options
+ */
GET_CONF_INT (conf, filename, log_level);
+ debugEnv = getenv("LIBVIRT_DEBUG");
+ if (debugEnv && *debugEnv && *debugEnv != '0') {
+ if (STREQ(debugEnv, "2") || STREQ(debugEnv, "info"))
+ log_level = VIR_LOG_INFO;
+ else if (STREQ(debugEnv, "3") || STREQ(debugEnv, "warning"))
+ log_level = VIR_LOG_WARN;
+ else if (STREQ(debugEnv, "4") || STREQ(debugEnv, "error"))
+ log_level = VIR_LOG_ERROR;
+ else
+ log_level = VIR_LOG_DEBUG;
+ }
if ((verbose) && (log_level >= VIR_LOG_WARN))
log_level = VIR_LOG_INFO;
virLogSetDefaultPriority(log_level);
virLogParseOutputs("0:stderr:libvirtd");
} else
virLogParseOutputs(log_outputs);
+ ret = 0;
+
free_and_fail:
VIR_FREE(log_filters);
VIR_FREE(log_outputs);
+ return(ret);
}
/* Read the config file if it exists.
/*
* First get all the logging settings and activate them
*/
- qemudSetLogging(conf, filename);
+ if (qemudSetLogging(conf, filename) < 0)
+ goto free_and_fail;
GET_CONF_INT (conf, filename, listen_tcp);
GET_CONF_INT (conf, filename, listen_tls);
# certificate signed by the CA in /etc/pki/libvirt-vnc/ca-cert.pem
#
vnc_tls_x509_verify = 1
+
+# Logging level:
+log_level = 4
+
+# Logging outputs:
+log_outputs="4:stderr"
+
+# Logging filters:
+log_filters=""
"
test Libvirtd_qemu.lns get conf =
{ "#comment" = "certificate signed by the CA in /etc/pki/libvirt-vnc/ca-cert.pem" }
{ "#comment" = "" }
{ "vnc_tls_x509_verify" = "1" }
+{ "#comment" = "Logging level:" }
+{ "log_level" = "4" }
+{ "#comment" = "Logging outputs:" }
+{ "log_outputs" = "4:stderr" }
+{ "#comment" = "Logging filters" }
+{ "log_filters" = "" }