cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjaytripa...@apache.org
Subject git commit: updated refs/heads/4.3 to 17bdbeb
Date Fri, 27 Dec 2013 13:04:52 GMT
Updated Branches:
  refs/heads/4.3 46f0b25c3 -> 17bdbebf9


CLOUDSTACK-4450: Possibility of /tmp/xapilog filling up the Root disk on Xenserver.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/17bdbebf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/17bdbebf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/17bdbebf

Branch: refs/heads/4.3
Commit: 17bdbebf93923da7228d31396395dd3227d0d053
Parents: 46f0b25
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Thu Aug 22 17:02:37 2013 +0530
Committer: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Committed: Fri Dec 27 18:25:46 2013 +0530

----------------------------------------------------------------------
 scripts/vm/hypervisor/xenserver/hostvmstats.py | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17bdbebf/scripts/vm/hypervisor/xenserver/hostvmstats.py
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/hostvmstats.py b/scripts/vm/hypervisor/xenserver/hostvmstats.py
index 38609b1..61cf2de 100644
--- a/scripts/vm/hypervisor/xenserver/hostvmstats.py
+++ b/scripts/vm/hypervisor/xenserver/hostvmstats.py
@@ -21,8 +21,17 @@ import XenAPI
 import urllib
 import time
 import logging
-logging.basicConfig(filename='/tmp/xapilog',level=logging.DEBUG)
-                      
+import logging.handlers
+
+LOG_FILENAME = '/tmp/xapilog'
+logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
+stats_logger = logging.getLogger('statsLogger')
+stats_logger.setLevel(logging.DEBUG)
+
+#handler with maxBytes=10MiB
+handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=10*1024*1024, backupCount=5)
+stats_logger.addHandler(handler)
+
 def get_stats(session, collect_host_stats, consolidation_function, interval, start_time):
   try:
     
@@ -41,12 +50,12 @@ def get_stats(session, collect_host_stats, consolidation_function, interval,
sta
     	url += "&interval=" + str(interval)
     	url += "&start=" + str(int(time.time())-100)
 
-    logging.debug("Calling URL: %s",url)
+    stats_logger.debug("Calling URL: %s",url)
     sock = urllib.URLopener().open(url)
     xml = sock.read()
     sock.close()
-    logging.debug("Size of returned XML: %s",len(xml))
+    stats_logger.debug("Size of returned XML: %s",len(xml))
     return xml
   except Exception,e:
-    logging.exception("get_stats() failed")
+    stats_logger.exception("get_stats() failed")
     raise


Mime
View raw message