Traceback exceptions

This commit is contained in:
Gerard Wagener 2010-01-20 10:00:16 +01:00
parent 4f7ed8bdc5
commit 047dc87859

View file

@ -10,7 +10,7 @@
#The aha framework can be launched then in screen #The aha framework can be launched then in screen
# #
#TODO implement signal handler HUP flushes the file #TODO implement signal handler HUP flushes the file
import dircache,os.path,time,sys,ConfigParser,getopt import dircache,os.path,time,sys,ConfigParser,getopt, traceback
from ahalib import * from ahalib import *
class PeriodTaks(): class PeriodTaks():
@ -66,7 +66,12 @@ class PeriodTaks():
try: try:
self.remove_old_msg(self.inqueue) self.remove_old_msg(self.inqueue)
except OSError,e: except OSError,e:
sys.stderr.write("%s\n"%str(e)) exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
traceback.print_exception(exceptionType, exceptionValue,
exceptionTraceback, file=sys.stderr)
traceback.print_tb(exceptionTraceback, file=sys.stdout)
def maintain_process_tree(self,mlist,exportFile): def maintain_process_tree(self,mlist,exportFile):
if mlist == None: if mlist == None:
@ -118,7 +123,10 @@ class PeriodTaks():
#Propagate message list for further processor #Propagate message list for further processor
return mlist return mlist
except OSError,e: except OSError,e:
sys.stderr.write("%s\n"%(str(e))) exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
traceback.print_exception(exceptionType, exceptionValue,
exceptionTraceback, file=sys.stderr)
traceback.print_tb(exceptionTraceback, file=sys.stdout)
#Parse the file an put the information in a log file for later processing #Parse the file an put the information in a log file for later processing
#One log file is handier than for each message a file #One log file is handier than for each message a file