From 3ea8a1187a825fdbcf7f78198afc00a2f3a8b974 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 28 Jul 2014 20:17:39 +0200 Subject: [PATCH] CLOUDSTACK-7195: log wide exceptions in security_group.py Some try/except in security_group.py catch a lot of exceptions. There was already one fixed in CLOUDSTACK-1052. Here is another one. We use logging.exception() to log those exceptions. Signed-off-by: Vincent Bernat Signed-off-by: Pierre-Luc Dion --- scripts/vm/network/security_group.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py index b4a355d9ecc..c4e7506340b 100755 --- a/scripts/vm/network/security_group.py +++ b/scripts/vm/network/security_group.py @@ -25,7 +25,6 @@ import os import xml.dom.minidom from optparse import OptionParser, OptionGroup, OptParseError, BadOptionError, OptionError, OptionConflictError, OptionValueError import re -import traceback import libvirt logpath = "/var/run/cloud/" # FIXME: Logs should reside in /var/log/cloud @@ -678,7 +677,7 @@ def get_rule_logs_for_vms(): log = get_rule_log_for_vm(name) result.append(log) except: - logging.debug("Failed to get rule logs, better luck next time!") + logging.exception("Failed to get rule logs, better luck next time!") print ";".join(result) @@ -883,8 +882,7 @@ def add_network_rules(vm_name, vm_id, vm_ip, signature, seqno, vmMac, rules, vif return 'true' except: - exceptionText = traceback.format_exc() - logging.debug("Failed to network rule !: " + exceptionText) + logging.exception("Failed to network rule !") def getVifs(vmName): vifs = []