From a064fa4227c4960052e2089d2b05bc684706f13e Mon Sep 17 00:00:00 2001 From: Chuck Thier Date: Wed, 12 Dec 2012 16:24:52 -0600 Subject: [PATCH] Fix needed for keystone middleware logging This is required for a fix in keystone middleware to log to the proxy logs. Since the keystone middleware doesn't initialize the log with swift.commong.utils.config_logger, it doesn't have the server and transaction id setup. This is required to fix bug #1089664 Change-Id: Icbb44076495a4d56065445c7a4d972ebede5d1e0 --- swift/common/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swift/common/utils.py b/swift/common/utils.py index 3bf207e291..bf5311cafd 100644 --- a/swift/common/utils.py +++ b/swift/common/utils.py @@ -624,6 +624,11 @@ class SwiftLogFormatter(logging.Formatter): """ def format(self, record): + if not hasattr(record, 'server'): + # Catch log messages that were not initiated by swift + # (for example, the keystone auth middleware) + record.server = record.name + return logging.Formatter.format(self, record) msg = logging.Formatter.format(self, record) if (record.txn_id and record.levelno != logging.INFO and record.txn_id not in msg):