summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2013-02-19 18:07:38 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2013-02-19 18:17:55 -0800
commitc4b6fca586f5c7426cdcefab694edc8214df20e5 (patch)
tree45268d85f1199947106a92975b7ab2b458155a97
parenta1cc88f63228ab42d1cf7958c0989c7d7d4b1ef2 (diff)
downloadoslo-c4b6fca586f5c7426cdcefab694edc8214df20e5.tar.gz
oslo-c4b6fca586f5c7426cdcefab694edc8214df20e5.tar.xz
oslo-c4b6fca586f5c7426cdcefab694edc8214df20e5.zip
Setup exception handler after configuring logging.
We currently set up the exc handler before we configure logging. This means that an error in the setup will try to raise an exception which will then fail to log properly because we haven't set up handlers properly yet. Therefore, simply rely on the default exception handler during setup and setup our exception handler immediately after logging is configured. Fixes bug 1130464 Change-Id: I4b80c646a7d7d5048c8fbadc67dbb9f607d2af69
-rw-r--r--openstack/common/log.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/openstack/common/log.py b/openstack/common/log.py
index 7d90975..b795ee4 100644
--- a/openstack/common/log.py
+++ b/openstack/common/log.py
@@ -325,16 +325,11 @@ def _create_logging_excepthook(product_name):
def setup(product_name):
"""Setup logging."""
- sys.excepthook = _create_logging_excepthook(product_name)
-
if CONF.log_config:
- try:
- logging.config.fileConfig(CONF.log_config)
- except Exception:
- traceback.print_exc()
- raise
+ logging.config.fileConfig(CONF.log_config)
else:
_setup_logging_from_conf(product_name)
+ sys.excepthook = _create_logging_excepthook(product_name)
def set_defaults(logging_context_format_string):