diff options
| author | Mate Lakat <mate.lakat@citrix.com> | 2012-07-31 17:53:57 +0100 |
|---|---|---|
| committer | Mate Lakat <mate.lakat@citrix.com> | 2012-08-01 11:27:46 +0100 |
| commit | 58404a1a9461900367dbb7a8b3f2f98441e12959 (patch) | |
| tree | 55a631848ed6bb142a25b91c6dbce3be719030ce /openstack | |
| parent | 7b5412ffc874c6ff89f61b286a69c88080b65f42 (diff) | |
| download | oslo-58404a1a9461900367dbb7a8b3f2f98441e12959.tar.gz oslo-58404a1a9461900367dbb7a8b3f2f98441e12959.tar.xz oslo-58404a1a9461900367dbb7a8b3f2f98441e12959.zip | |
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: Ie8061d003b05ea8b00db5d8ed8fa445ccc822942
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/log.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/openstack/common/log.py b/openstack/common/log.py index 6d1d9f9..76962c2 100644 --- a/openstack/common/log.py +++ b/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: |
