From 43fef88b7494ff44e6fc036323d8e46c5af57ba4 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 19 Feb 2013 17:20:30 -0800 Subject: [PATCH] Fix broken logging imports. This fixes all of the files incorrectly importing logging directly and removes the workaround in hacking.py that was due to improper from nova.openstack.common.log import logging statements. Change-Id: Icfc25dc148c4a7b5fa7f6a7b609cd6c3d94efee1 --- HACKING.rst | 1 - nova/tests/test_imagecache.py | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index 30f87576..223f3ed7 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -63,7 +63,6 @@ Imports - imports from ``migrate`` package - imports from ``sqlalchemy`` package - imports from ``nova.db.sqlalchemy.session`` module -- imports from ``nova.openstack.common.log.logging`` package - imports from ``nova.db.sqlalchemy.migration.versioning_api`` package Example:: diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py index 8c752bbb..0c5c6d02 100644 --- a/nova/tests/test_imagecache.py +++ b/nova/tests/test_imagecache.py @@ -20,7 +20,6 @@ import contextlib import cStringIO import hashlib import json -import logging import os import time @@ -30,7 +29,7 @@ from nova.compute import vm_states from nova import conductor from nova import db from nova.openstack.common import importutils -from nova.openstack.common import log +from nova.openstack.common import log as logging from nova import test from nova import utils from nova.virt.libvirt import imagecache @@ -40,7 +39,7 @@ CONF = cfg.CONF CONF.import_opt('compute_manager', 'nova.service') CONF.import_opt('host', 'nova.netconf') -LOG = log.getLogger(__name__) +LOG = logging.getLogger(__name__) class ImageCacheManagerTestCase(test.TestCase): @@ -341,10 +340,10 @@ class ImageCacheManagerTestCase(test.TestCase): @contextlib.contextmanager def _intercept_log_messages(self): try: - mylog = log.getLogger('nova') + mylog = logging.getLogger('nova') stream = cStringIO.StringIO() - handler = logging.StreamHandler(stream) - handler.setFormatter(log.LegacyFormatter()) + handler = logging.logging.StreamHandler(stream) + handler.setFormatter(logging.LegacyFormatter()) mylog.logger.addHandler(handler) yield stream finally: