Changed default handler for uncaughted exceptions. Logging with level critical instead of print to stderr
This commit is contained in:
parent
396b02f876
commit
af343a09b6
@ -31,6 +31,7 @@ import cStringIO
|
||||
import json
|
||||
import logging
|
||||
import logging.handlers
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from nova import flags
|
||||
@ -191,6 +192,10 @@ class NovaLogger(logging.Logger):
|
||||
kwargs.pop('exc_info')
|
||||
self.error(message, **kwargs)
|
||||
|
||||
def handle_exception(type, value, tb):
|
||||
logging.root.critical(str(value), exc_info=(type, value, tb))
|
||||
|
||||
sys.excepthook = handle_exception
|
||||
logging.setLoggerClass(NovaLogger)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user