ENH: Log trace info for failed action events when in DEBUG

pull/688/head
Steven Hiscocks 2014-04-12 11:27:05 +01:00
parent 9fcb92524e
commit 1369701f87
1 changed files with 8 additions and 4 deletions

View File

@ -215,7 +215,8 @@ class Actions(JailThread, Mapping):
action.start() action.start()
except Exception as e: except Exception as e:
logSys.error("Failed to start jail '%s' action '%s': %s", logSys.error("Failed to start jail '%s' action '%s': %s",
self._jail.name, name, e) self._jail.name, name, e,
exc_info=logSys.getEffectiveLevel()<=logging.DEBUG)
while self.active: while self.active:
if not self.idle: if not self.idle:
#logSys.debug(self._jail.name + ": action") #logSys.debug(self._jail.name + ": action")
@ -234,7 +235,8 @@ class Actions(JailThread, Mapping):
action.stop() action.stop()
except Exception as e: except Exception as e:
logSys.error("Failed to stop jail '%s' action '%s': %s", logSys.error("Failed to stop jail '%s' action '%s': %s",
self._jail.name, name, e) self._jail.name, name, e,
exc_info=logSys.getEffectiveLevel()<=logging.DEBUG)
logSys.debug(self._jail.name + ": action terminated") logSys.debug(self._jail.name + ": action terminated")
return True return True
@ -278,7 +280,8 @@ class Actions(JailThread, Mapping):
except Exception as e: except Exception as e:
logSys.error( logSys.error(
"Failed to execute ban jail '%s' action '%s': %s", "Failed to execute ban jail '%s' action '%s': %s",
self._jail.name, name, e) self._jail.name, name, e,
exc_info=logSys.getEffectiveLevel()<=logging.DEBUG)
return True return True
else: else:
logSys.notice("[%s] %s already banned" % (self._jail.name, logSys.notice("[%s] %s already banned" % (self._jail.name,
@ -325,7 +328,8 @@ class Actions(JailThread, Mapping):
except Exception as e: except Exception as e:
logSys.error( logSys.error(
"Failed to execute unban jail '%s' action '%s': %s", "Failed to execute unban jail '%s' action '%s': %s",
self._jail.name, name, e) self._jail.name, name, e,
exc_info=logSys.getEffectiveLevel()<=logging.DEBUG)
@property @property
def status(self): def status(self):