From 346884d48c88e1b2d550e8cef878e604c39bf10d Mon Sep 17 00:00:00 2001 From: "Luis A. Garcia" Date: Mon, 10 Mar 2014 22:03:08 -0600 Subject: [PATCH] Add default user_identity to logging record Just like instance and color formatting parameters we can't assume that the user_identity will always be in the logging record. This patch adds a default value for it if missing to avoid exceptions. Change-Id: Id02902adb2579d44f1f4f066757ef3855b5ece87 Closes-Bug: #1290503 --- openstack/common/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/common/log.py b/openstack/common/log.py index 3396487f9..7d9a46c0c 100644 --- a/openstack/common/log.py +++ b/openstack/common/log.py @@ -650,7 +650,7 @@ class ContextFormatter(logging.Formatter): # NOTE(sdague): default the fancier formatting params # to an empty string so we don't throw an exception if # they get used - for key in ('instance', 'color'): + for key in ('instance', 'color', 'user_identity'): if key not in record.__dict__: record.__dict__[key] = ''