diff options
| author | Andrew Bogott <abogott@wikimedia.org> | 2012-08-03 01:57:40 -0500 |
|---|---|---|
| committer | Andrew Bogott <abogott@wikimedia.org> | 2012-08-03 02:35:15 -0500 |
| commit | a7987aaa86c9cd8c6509118028a61ce7445ec125 (patch) | |
| tree | 687f8635411f51c251474f85eb92bd1d4ade385b /nova/openstack | |
| parent | 51002f0d0f85f077bbbfed1d151df59240775ff8 (diff) | |
| download | nova-a7987aaa86c9cd8c6509118028a61ce7445ec125.tar.gz nova-a7987aaa86c9cd8c6509118028a61ce7445ec125.tar.xz nova-a7987aaa86c9cd8c6509118028a61ce7445ec125.zip | |
Migrate a logging change from common:
commit 58404a1a9461900367dbb7a8b3f2f98441e12959
Author: Mate Lakat <mate.lakat@citrix.com>
Date: Tue Jul 31 17:53:57 2012 +0100
Install a qualified except hook.
Fixes bug 1031351.
As an Exception is raised, it was not visible in the log, because
it wasn't qualified. The fix sets up the exception hook to be
qualified as the product_name.
Change-Id: I38c48d0dd2ac885fcb226310b6039be667af9e0d
Diffstat (limited to 'nova/openstack')
| -rw-r--r-- | nova/openstack/common/log.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/nova/openstack/common/log.py b/nova/openstack/common/log.py index 250b10501..31238062b 100644 --- a/nova/openstack/common/log.py +++ b/nova/openstack/common/log.py @@ -257,16 +257,18 @@ class PublishErrorsHandler(logging.Handler): dict(error=record.msg)) -def handle_exception(type, value, tb): - extra = {} - if CONF.verbose: - extra['exc_info'] = (type, value, tb) - getLogger().critical(str(value), **extra) +def _create_logging_excepthook(product_name): + def logging_excepthook(type, value, tb): + extra = {} + if CONF.verbose: + extra['exc_info'] = (type, value, tb) + getLogger(product_name).critical(str(value), **extra) + return logging_excepthook def setup(product_name): """Setup logging.""" - sys.excepthook = handle_exception + sys.excepthook = _create_logging_excepthook(product_name) if CONF.log_config: try: |
