Changed default handler for uncaughted exceptions. Logging with level critical instead of print to stderr
This commit is contained in:
@@ -31,6 +31,7 @@ import cStringIO
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
@@ -191,6 +192,10 @@ class NovaLogger(logging.Logger):
|
|||||||
kwargs.pop('exc_info')
|
kwargs.pop('exc_info')
|
||||||
self.error(message, **kwargs)
|
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)
|
logging.setLoggerClass(NovaLogger)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user