summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/log.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/log.py b/nova/log.py
index e1c9f46f4..70719e95b 100644
--- a/nova/log.py
+++ b/nova/log.py
@@ -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)