From 195935cccfb92dc01a78e302174ea0257b51b58e Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Mon, 22 Jun 2015 15:49:23 -0400 Subject: [PATCH] Slightly better exception handling and logging to help with SAAS-884 --- python_apps/pypo/pypo/listenerstat.py | 1 + python_apps/pypo/pypo/pypofile.py | 9 ++++++++- python_apps/pypo/pypo/pypopush.py | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/python_apps/pypo/pypo/listenerstat.py b/python_apps/pypo/pypo/listenerstat.py index a7f99e816..fc7adc74a 100644 --- a/python_apps/pypo/pypo/listenerstat.py +++ b/python_apps/pypo/pypo/listenerstat.py @@ -150,6 +150,7 @@ class ListenerStat(Thread): self.logger.error('Exception: %s', e) time.sleep(120) + self.logger.info('ListenerStat thread exiting') if __name__ == "__main__": diff --git a/python_apps/pypo/pypo/pypofile.py b/python_apps/pypo/pypo/pypofile.py index ff2103df2..157c8e1b5 100644 --- a/python_apps/pypo/pypo/pypofile.py +++ b/python_apps/pypo/pypo/pypofile.py @@ -5,6 +5,8 @@ from Queue import Empty import logging import shutil +import time +import traceback import os import sys import stat @@ -203,5 +205,10 @@ class PypoFile(Thread): """ Entry point of the thread """ - self.main() + try: self.main() + except Exception, e: + top = traceback.format_exc() + self.logger.error('PypoFile Exception: %s', top) + time.sleep(5) + self.logger.info('PypoFile thread exiting') diff --git a/python_apps/pypo/pypo/pypopush.py b/python_apps/pypo/pypo/pypopush.py index 48d3cd13f..9b280bac1 100644 --- a/python_apps/pypo/pypo/pypopush.py +++ b/python_apps/pypo/pypo/pypopush.py @@ -153,4 +153,5 @@ class PypoPush(Thread): top = traceback.format_exc() self.logger.error('Pypo Push Exception: %s', top) time.sleep(5) + self.logger.info('PypoPush thread exiting')