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
This commit is contained in:
Vishvananda Ishaya
2013-02-19 17:20:30 -08:00
parent b7091b4d52
commit 43fef88b74
2 changed files with 5 additions and 7 deletions

View File

@@ -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::

View File

@@ -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: