diff --git a/ChangeLog b/ChangeLog index de4da8a8b4..32849880be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Dec 22 17:13:42 CET 2008 Daniel Veillard + + * 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 * qemud/mdns.c: fix a compilation problem in the switch diff --git a/qemud/qemud.c b/qemud/qemud.c index 3e979ec51e..799ae90645 100644 --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -2042,12 +2042,30 @@ remoteReadSaslAllowedUsernameList (virConfPtr conf ATTRIBUTE_UNUSED, * 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); @@ -2068,9 +2086,12 @@ qemudSetLogging(virConfPtr conf, const char *filename) { 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. @@ -2106,7 +2127,8 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename) /* * 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); diff --git a/qemud/test_libvirtd_qemu.aug b/qemud/test_libvirtd_qemu.aug index 3ac8ee86aa..ce405a27e9 100644 --- a/qemud/test_libvirtd_qemu.aug +++ b/qemud/test_libvirtd_qemu.aug @@ -49,6 +49,15 @@ vnc_tls_x509_cert_dir = \"/etc/pki/libvirt-vnc\" # 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 = @@ -101,3 +110,9 @@ vnc_tls_x509_verify = 1 { "#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" = "" } diff --git a/tests/Makefile.am b/tests/Makefile.am index 52906067e4..d8b5e44fef 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -105,6 +105,7 @@ TESTS_ENVIRONMENT = \ PATH="$(path_add)$(PATH_SEPARATOR)$$PATH" \ SHELL="$(SHELL)" \ LIBVIRT_DRIVER_DIR="$(abs_top_builddir)/src/.libs" \ + LIBVIRT_DEBUG="error" \ LC_ALL=C \ $(VG) diff --git a/tests/daemon-conf b/tests/daemon-conf index 65a965500f..b357c39579 100755 --- a/tests/daemon-conf +++ b/tests/daemon-conf @@ -56,8 +56,9 @@ while :; do test $i = $n && break - # Filter out some ignorable diagnostics. + # Filter out some ignorable diagnostics and drop timestamps sed \ + -e 's/.*: error : //' \ -e '/^Cannot set group when not running as root$/d' \ -e '/^libnuma: Warning: .sys not mounted or no numa system/d' \ err > k && mv k err