Log kwargs on a failed String Format Operation

fixes bug 971552

If the string format operation in NovaException raises an exception be sure to
log the kwargs at log level error

Change-Id: Idfc54b8c05256bd7c849c86dc45f0b493727fe58
This commit is contained in:
Andrew Clay Shafer
2012-04-02 10:01:04 -04:00
parent 5092c4d5cd
commit 39280e539c

View File

@@ -168,6 +168,11 @@ class NovaException(Exception):
message = self.message % kwargs
except Exception as e:
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception(_('Exception in string format operation'))
for name, value in kwargs.iteritems():
LOG.error("%s: %s" % (name, value))
# at least get the core message out if something happened
message = self.message