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:
@@ -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::
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user