Properly log exceptions

This commit is contained in:
Einar Forselv 2019-12-05 10:15:49 +01:00
parent 98fe448348
commit c59f022a55
2 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ def send(subject: str = None, body: str = None, alert_type: str = 'INFO'):
)
except Exception as ex:
logger.error("Exception raised when sending alert [%s]: %s", instance.name, ex)
logger.exception(ex)
if len(alert_classes) == 0:
logger.info("No alerts configured")

View File

@ -51,6 +51,6 @@ class SMTPAlert(BaseAlert):
server.sendmail(self.user, self.to, msg.as_string())
logger.info('Email sent')
except Exception as ex:
logger.error(ex)
logger.exception(ex)
finally:
server.close()