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
This commit is contained in:
Chuck Thier 2012-12-12 16:24:52 -06:00
parent 1135c9e256
commit a064fa4227

View File

@ -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):