From a0474f0e4c8fb3d202c3ee9dbf091f1f8637d2da Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 27 Apr 2014 05:52:33 -0700 Subject: [PATCH] Don't translate debug level logs in nova.objects Our translation policy (https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls for not translating debug level logs. This is to help prioritize log translation. Furthermore translation has a performance overhead, even if the log isn't used (since nova doesn't support lazy translation yet). Change-Id: I8bdc66c0711539b373884dc35a84ee8143e6de67 --- nova/hacking/checks.py | 1 + nova/objects/block_device.py | 2 +- nova/objects/instance.py | 2 +- nova/objects/service.py | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/hacking/checks.py b/nova/hacking/checks.py index 019b692bf2..743624666f 100644 --- a/nova/hacking/checks.py +++ b/nova/hacking/checks.py @@ -213,6 +213,7 @@ def no_translate_debug_logs(logical_line, filename): "nova/cells", "nova/conductor", "nova/compute", + "nova/objects", ] if max([name in filename for name in dirs]): if logical_line.startswith("LOG.debug(_("): diff --git a/nova/objects/block_device.py b/nova/objects/block_device.py index 87dd730dfe..4e30f8d888 100644 --- a/nova/objects/block_device.py +++ b/nova/objects/block_device.py @@ -162,7 +162,7 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject): raise exception.OrphanedObjectError(method='obj_load_attr', objtype=self.obj_name()) - LOG.debug(_("Lazy-loading `%(attr)s' on %(name)s uuid %(uuid)s"), + LOG.debug("Lazy-loading `%(attr)s' on %(name)s uuid %(uuid)s", {'attr': attrname, 'name': self.obj_name(), 'uuid': self.uuid, diff --git a/nova/objects/instance.py b/nova/objects/instance.py index d9b8a2b067..a4ce30283f 100644 --- a/nova/objects/instance.py +++ b/nova/objects/instance.py @@ -513,7 +513,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject): raise exception.OrphanedObjectError(method='obj_load_attr', objtype=self.obj_name()) - LOG.debug(_("Lazy-loading `%(attr)s' on %(name)s uuid %(uuid)s"), + LOG.debug("Lazy-loading `%(attr)s' on %(name)s uuid %(uuid)s", {'attr': attrname, 'name': self.obj_name(), 'uuid': self.uuid, diff --git a/nova/objects/service.py b/nova/objects/service.py index f34f054520..6cd9a8e87b 100644 --- a/nova/objects/service.py +++ b/nova/objects/service.py @@ -18,7 +18,6 @@ from nova import exception from nova.objects import base from nova.objects import compute_node from nova.objects import fields -from nova.openstack.common.gettextutils import _ from nova.openstack.common import log as logging @@ -73,7 +72,7 @@ class Service(base.NovaPersistentObject, base.NovaObject): if not self._context: raise exception.OrphanedObjectError(method='obj_load_attr', objtype=self.obj_name()) - LOG.debug(_("Lazy-loading `%(attr)s' on %(name)s id %(id)s"), + LOG.debug("Lazy-loading `%(attr)s' on %(name)s id %(id)s", {'attr': attrname, 'name': self.obj_name(), 'id': self.id,