[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxl: open libxl log stream with libvirtd log_level



Instead of a hardcoded DEBUG log level, use the overall
daemon log level specified in libvirtd.conf when opening
a log stream with libxl. libxl is very verbose when DEBUG
log level is set, resulting in huge log files that can
potentially fill a disk. Control of libxl verbosity should
be placed in the administrator's hands.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_conf.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index a76ad5a..40fa4b5 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1496,6 +1496,7 @@ libxlDriverConfigNew(void)
 {
     libxlDriverConfigPtr cfg;
     char *log_file = NULL;
+    xentoollog_level log_level;
     char ebuf[1024];
     unsigned int free_mem;
 
@@ -1540,9 +1541,24 @@ libxlDriverConfigNew(void)
     }
     VIR_FREE(log_file);
 
+    switch (virLogGetDefaultPriority()) {
+    case VIR_LOG_DEBUG:
+        log_level = XTL_DEBUG;
+        break;
+    case VIR_LOG_INFO:
+        log_level = XTL_INFO;
+        break;
+    case VIR_LOG_WARN:
+        log_level = XTL_WARN;
+        break;
+    case VIR_LOG_ERROR:
+        log_level = XTL_ERROR;
+        break;
+    }
+
     cfg->logger =
         (xentoollog_logger *)xtl_createlogger_stdiostream(cfg->logger_file,
-                                      XTL_DEBUG, XTL_STDIOSTREAM_SHOW_DATE);
+                                      log_level, XTL_STDIOSTREAM_SHOW_DATE);
     if (!cfg->logger) {
         VIR_ERROR(_("cannot create logger for libxenlight, disabling driver"));
         goto error;
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.