server/utils.py
branchstable
changeset 6765 b922e3a817e9
parent 6427 c8a5ac2d1eaa
child 7573 c8f8762c986d
--- a/server/utils.py	Tue Jan 04 14:41:10 2011 +0100
+++ b/server/utils.py	Tue Jan 04 15:03:48 2011 +0100
@@ -20,6 +20,7 @@
 
 import sys
 import string
+import logging
 from threading import Timer, Thread
 from getpass import getpass
 from random import choice
@@ -129,6 +130,10 @@
         def auto_restart_func(self=self, func=func, args=args):
             try:
                 func(*args)
+            except:
+                logger = logging.getLogger('cubicweb.repository')
+                logger.exception('Unhandled exception in LoopTask %s', self.name)
+                raise
             finally:
                 self.start()
         self.func = auto_restart_func
@@ -158,6 +163,10 @@
         def auto_remove_func(self=self, func=target):
             try:
                 func()
+            except:
+                logger = logging.getLogger('cubicweb.repository')
+                logger.exception('Unhandled exception in RepoThread %s', self._name)
+                raise
             finally:
                 self.running_threads.remove(self)
         Thread.__init__(self, target=auto_remove_func)