diff --git a/ChangeLog b/ChangeLog
index 8af5bd4fc2..d8cc46fe3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jul 1 13:18:37 CEST 2009 Daniel Veillard
In both case the syntax for filters and outputs is similar.
The format for a filter is:
x:name@@ -170,15 +170,15 @@ given
name
as the identx:file:file_path
output to a file, with the given
filepathIn all cases the x prefix is the minimal level, acting as a filter:
-Multiple output can be defined , they just need to be separated by
- spaces, e.g.: "3:syslog:libvirtd 0:file:/tmp/libvirt.log"
+ spaces, e.g.: "3:syslog:libvirtd 1:file:/tmp/libvirt.log"
will log all warnings and errors to syslog under the libvirtd ident
but also log everything debugging and informations included in the
file /tmp/libvirt.log
For example setting up the following:
export LIBVIRT_DEBUG=1 -export LIBVIRT_LOG_OUTPUTS="0:file:virsh.log"+export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"
and then running virsh will accumulate the logs in the
virsh.log
file in a way similar to:
14:29:04.771: debug : virInitialize:278 : register drivers diff --git a/docs/logging.html.in b/docs/logging.html.in index 11ea68ca21..fcd100ff52 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -49,7 +49,6 @@
In all cases the x prefix is the minimal level, acting as a filter:
Multiple output can be defined , they just need to be separated by
- spaces, e.g.: "3:syslog:libvirtd 0:file:/tmp/libvirt.log"
+ spaces, e.g.: "3:syslog:libvirtd 1:file:/tmp/libvirt.log"
will log all warnings and errors to syslog under the libvirtd ident
but also log everything debugging and informations included in the
file /tmp/libvirt.log
For example setting up the following:
export LIBVIRT_DEBUG=1 -export LIBVIRT_LOG_OUTPUTS="0:file:virsh.log"+export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"
and then running virsh will accumulate the logs in the
virsh.log
file in a way similar to:
14:29:04.771: debug : virInitialize:278 : register drivers diff --git a/qemud/libvirtd.conf b/qemud/libvirtd.conf index 1fd5918d88..49de466349 100644 --- a/qemud/libvirtd.conf +++ b/qemud/libvirtd.conf @@ -269,7 +269,7 @@ # Logging controls # -# Logging level: 0 none, 4 errors, 3 warnings, 2 informations, 1 debug +# Logging level: 4 errors, 3 warnings, 2 informations, 1 debug # basically 1 will log everything possible #log_level = 3 @@ -303,13 +303,12 @@ # x:file:file_path # output to a file, with the given filepath # In all case the x prefix is the minimal level, acting as a filter -# 0: everything # 1: DEBUG # 2: INFO # 3: WARNING # 4: ERROR # -# Multiple output can be defined , they just need to be separated by spaces. +# Multiple output can be defined, they just need to be separated by spaces. # e.g.: # log_outputs="3:syslog:libvirtd" # to log all warnings and errors to syslog under the libvirtd ident diff --git a/qemud/qemud.c b/qemud/qemud.c index b5e36651b4..da20aa94da 100644 --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -128,7 +128,7 @@ static int sigwrite = -1; /* Signal handler pipe */ static int ipsock = 0; /* -l Listen for TCP/IP */ /* Defaults for logging */ -static int log_level = 3; +static int log_level = VIR_LOG_DEFAULT; static char *log_filters = NULL; static char *log_outputs = NULL; @@ -2499,15 +2499,16 @@ qemudSetLogging(virConfPtr conf, const char *filename) { log_outputs = strdup(debugEnv); } if (!log_outputs) { + char *tmp = NULL; if (godaemon) { - char *tmp = NULL; if (virAsprintf (&tmp, "%d:syslog:libvirtd", log_level) < 0) goto free_and_fail; - virLogParseOutputs (tmp); - VIR_FREE (tmp); } else { - virLogParseOutputs("0:stderr:libvirtd"); + if (virAsprintf(&tmp, "%d:stderr", log_level) < 0) + goto free_and_fail; } + virLogParseOutputs(tmp); + VIR_FREE(tmp); } else { virLogParseOutputs(log_outputs); } diff --git a/src/logging.c b/src/logging.c index fd1d5d4d41..d13ae0f20c 100644 --- a/src/logging.c +++ b/src/logging.c @@ -119,7 +119,7 @@ static int virLogNbOutputs = 0; /* * Default priorities */ -static virLogPriority virLogDefaultPriority = VIR_LOG_WARN; +static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT; static int virLogResetFilters(void); static int virLogResetOutputs(void); @@ -174,7 +174,7 @@ int virLogStartup(void) { virLogLen = 0; virLogStart = 0; virLogEnd = 0; - virLogDefaultPriority = VIR_LOG_WARN; + virLogDefaultPriority = VIR_LOG_DEFAULT; virLogUnlock(); return(0); } @@ -196,7 +196,7 @@ int virLogReset(void) { virLogLen = 0; virLogStart = 0; virLogEnd = 0; - virLogDefaultPriority = VIR_LOG_WARN; + virLogDefaultPriority = VIR_LOG_DEFAULT; virLogUnlock(); return(0); } @@ -689,7 +689,7 @@ int virLogParseOutputs(const char *outputs) { virSkipSpaces(&cur); while (*cur != 0) { prio= virParseNumber(&cur); - if ((prio < 0) || (prio > 4)) + if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR)) return(-1); if (*cur != ':') return(-1); @@ -770,7 +770,7 @@ int virLogParseFilters(const char *filters) { virSkipSpaces(&cur); while (*cur != 0) { prio= virParseNumber(&cur); - if ((prio < 0) || (prio > 4)) + if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR)) return(-1); if (*cur != ':') return(-1); diff --git a/src/logging.h b/src/logging.h index d99bb31b70..0b9ae793b2 100644 --- a/src/logging.h +++ b/src/logging.h @@ -77,6 +77,8 @@ typedef enum { VIR_LOG_ERROR, } virLogPriority; +#define VIR_LOG_DEFAULT VIR_LOG_WARN + /** * virLogOutputFunc: * @category: the category for the message