summaryrefslogtreecommitdiffstats
path: root/nova/log.py
diff options
context:
space:
mode:
authorNaveed Massjouni <naveedm9@gmail.com>2011-05-05 23:14:46 -0400
committerNaveed Massjouni <naveedm9@gmail.com>2011-05-05 23:14:46 -0400
commit3ee0507ddc6bb7e15834144acc47c354396fbc70 (patch)
tree6ed7f2abafca3d43e37576dcc265994e0ee85399 /nova/log.py
parentc03e9805328afe1d03fa65ac93d2b91ba04c229e (diff)
downloadnova-3ee0507ddc6bb7e15834144acc47c354396fbc70.tar.gz
nova-3ee0507ddc6bb7e15834144acc47c354396fbc70.tar.xz
nova-3ee0507ddc6bb7e15834144acc47c354396fbc70.zip
Publish errors via nova.notifier
Diffstat (limited to 'nova/log.py')
-rw-r--r--nova/log.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/log.py b/nova/log.py
index 096279f7c..3e587891a 100644
--- a/nova/log.py
+++ b/nova/log.py
@@ -35,6 +35,7 @@ import os
import sys
import traceback
+import nova
from nova import flags
from nova import version
@@ -63,6 +64,7 @@ flags.DEFINE_list('default_log_levels',
'eventlet.wsgi.server=WARN'],
'list of logger=LEVEL pairs')
flags.DEFINE_bool('use_syslog', False, 'output to syslog')
+flags.DEFINE_bool('publish_errors', True, 'publish error events')
flags.DEFINE_string('logfile', None, 'output to named file')
@@ -258,12 +260,19 @@ class NovaRootLogger(NovaLogger):
else:
self.removeHandler(self.filelog)
self.addHandler(self.streamlog)
+ if FLAGS.publish_errors:
+ self.addHandler(PublishErrorsHandler(ERROR))
if FLAGS.verbose:
self.setLevel(DEBUG)
else:
self.setLevel(INFO)
+class PublishErrorsHandler(logging.Handler):
+ def emit(self, record):
+ nova.notifier.notify('error', record)
+
+
def handle_exception(type, value, tb):
extra = {}
if FLAGS.verbose: