From 8ad87f634c3403085964619d410eae60b3c64afe Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Wed, 22 Dec 2010 16:48:25 +0000 Subject: [PATCH] fix fancy txnid logging --- bin/st | 2 ++ swift/common/utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/st b/bin/st index b41aca67ec..f7009daf21 100755 --- a/bin/st +++ b/bin/st @@ -44,6 +44,8 @@ except: try: from swift.common.bufferedhttp \ import BufferedHTTPConnection as HTTPConnection + import __builtin__ # bufferedhttp uses automagic gettext + setattr(__builtin__, '_', lambda x: x) except: from httplib import HTTPConnection diff --git a/swift/common/utils.py b/swift/common/utils.py index c837456591..da71253e7b 100644 --- a/swift/common/utils.py +++ b/swift/common/utils.py @@ -341,7 +341,8 @@ class NamedFormatter(logging.Formatter): def format(self, record): msg = logging.Formatter.format(self, record) - if record.levelno != logging.INFO and self.logger.txn_id: + if self.logger.txn_id and (record.levelno != logging.INFO or + self.logger.txn_id not in msg): return '%s %s (txn: %s)' % (self.server, msg, self.logger.txn_id) else: return '%s %s' % (self.server, msg)