I want all exceptions from the log file to be logged in my TB application. So, I tried to use custom sys.excepthook, as usual. But every exception still occurs and nothing is logged. Here is my code:
class RootController(BaseController): secc = SecureController() error = ErrorController() def __init__(self): self.installExceptHook() super(RootController, self).__init__() def installExceptHook(self): def exceptHook(type, value, tb): logger = logging.getLogger('app') logger.critical(''.join(traceback.format_exception(type, value, tb))) sys.excepthook = exceptHook
When I call ValueError in the index method:
@expose('app.templates.index') def index(self, **kwargs): raise ValueError return dict(page = 'index')
I still get the WebError Traceback page in my browser and nothing is logged.
Do you know what I am doing wrong? Any idea?
source share