summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKun Huang <gareth@unitedstack.com>2013-07-22 00:02:56 +0800
committerKun Huang <gareth@unitedstack.com>2013-07-30 23:29:01 +0800
commit4e46f9807a74b97aaae8178c551258ca0bf97759 (patch)
treeba18bd3ec61d30c36544952cb8f5dd2aec61cf8e
parent97a5b49d96f4ed31c8fa9795d835480d58da82cd (diff)
downloadkeystone-4e46f9807a74b97aaae8178c551258ca0bf97759.tar.gz
keystone-4e46f9807a74b97aaae8178c551258ca0bf97759.tar.xz
keystone-4e46f9807a74b97aaae8178c551258ca0bf97759.zip
use 'exc_info=True' instead of import traceback
We need log traceback message sometime, but people who ignore 'exc_info' argument would import traceback for getting traceback message. This work is already done by 'exc_info' in logging module. For example: logger.error('msg', exc_info=True) # exc_info evaluate as true and log message from sys.exc_info() logger.debug('msg', exc_info=(type, value, traceback)) # exc_info evaluate as an exception tuple and log message from this tuple logger.exception('msg') # exception add exc_info=1 automatically Change-Id: I9e1caf05fcf06bb977597076ebe278b593d70bf4
-rw-r--r--keystone/common/logging.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/keystone/common/logging.py b/keystone/common/logging.py
index 8c036f02..d221edb7 100644
--- a/keystone/common/logging.py
+++ b/keystone/common/logging.py
@@ -23,7 +23,6 @@ import logging
import logging.config
import logging.handlers
import pprint
-import traceback
# A list of things we want to replicate from logging.
@@ -78,8 +77,7 @@ def fail_gracefully(f):
try:
return f(*args, **kw)
except Exception as e:
- # tracebacks are kept in the debug log
- logging.debug(traceback.format_exc(e))
+ logging.debug(e, exc_info=True)
# exception message is printed to all logs
logging.critical(e)