提交 b4962134 编写于 作者: D Daniel Veillard

fix make check with the new logging support

* 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
上级 5af1e59d
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
......
......@@ -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);
......
......@@ -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" = "" }
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册