From ea8542377f13f729ca89cf2699e55b6760519abf Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 30 Apr 2013 18:08:30 -0700 Subject: [PATCH] Handle all exceptions in log-pusher.py. * modules/openstack_project/files/logstash/log-pusher.py: Catch and log all exceptions that make it to the top of our poll loops. Allows for greater debugging of the script. Change-Id: I4f8bb2ea1629ee98f5e70c978a299c889a22a939 Reviewed-on: https://review.openstack.org/27876 Reviewed-by: James E. Blair Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- .../openstack_project/files/logstash/log-pusher.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/openstack_project/files/logstash/log-pusher.py b/modules/openstack_project/files/logstash/log-pusher.py index 84808a2bc7..b2f58939cd 100644 --- a/modules/openstack_project/files/logstash/log-pusher.py +++ b/modules/openstack_project/files/logstash/log-pusher.py @@ -84,7 +84,10 @@ class LogRetriever(threading.Thread): def run(self): while True: - self._handle_event() + try: + self._handle_event() + except: + logging.exception("Exception retrieving log event.") def _handle_event(self): event = self.eventq.get() @@ -252,7 +255,11 @@ def main(): retriever.daemon = True retriever.start() while True: - processor.handle_log_event() + try: + processor.handle_log_event() + except: + logging.exception("Exception processing log event.") + raise if __name__ == '__main__':