]> xenbits.xensource.com Git - libvirt.git/commitdiff
fix make check with the new logging support
authorDaniel Veillard <veillard@redhat.com>
Mon, 22 Dec 2008 16:16:10 +0000 (16:16 +0000)
committerDaniel Veillard <veillard@redhat.com>
Mon, 22 Dec 2008 16:16:10 +0000 (16:16 +0000)
* 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
Daniel

ChangeLog
qemud/qemud.c
qemud/test_libvirtd_qemu.aug
tests/Makefile.am
tests/daemon-conf

index de4da8a8b4118a931e7151fbcc863c51ba36413d..32849880bea87a47158ce32703fb748f5f77072c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
index 3e979ec51e7d74a6b267db4d8cf909ecf69a9cbb..799ae90645e1d01f4c2d23add9440a5ef4145c2d 100644 (file)
@@ -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);
index 3ac8ee86aae5b7ef2b4cbeb61eee517cd1f336f5..ce405a27e9f4fa7ee9910d36f06df74cfa30969e 100644 (file)
@@ -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" = "" }
index 52906067e4f03fbdeac11a2c64ab792c3bccd219..d8b5e44fef132d544fbf51cf96fb23a839d846bd 100644 (file)
@@ -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)
 
index 65a965500fab4c703784e25708d284e24ecfa6e2..b357c39579a1349ba02c8d9d2c8f971ecd0576e1 100755 (executable)
@@ -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