cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjaytripa...@apache.org
Subject [1/3] git commit: updated refs/heads/master to f6b063d
Date Fri, 27 Dec 2013 12:54:26 GMT
Updated Branches:
  refs/heads/master 40a990986 -> f6b063de7


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/5eda0915
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5eda0915
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5eda0915

Branch: refs/heads/master
Commit: 5eda091530c0ce5dbf0ac469e6c7c7b58aa48744
Parents: 40a9909
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 17:12:23 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/5eda0915/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