Use oslo.log
Convert the use of the incubated version of the log module to the new oslo.log library. Sync oslo-incubator modules to update their imports as well. Co-Authored-By: Doug Hellmann <doug@doughellmann.com> Change-Id: Ic4932e3f58191869c30bd07a010a6e9fdcb2a12c
This commit is contained in:
@@ -29,10 +29,10 @@ these objects be simple dictionaries.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_db import concurrency
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.cells import rpcapi as cells_rpcapi
|
||||
from nova.i18n import _LE
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
|
||||
db_opts = [
|
||||
|
@@ -30,6 +30,7 @@ from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
from oslo_db.sqlalchemy import utils as sqlalchemyutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
import retrying
|
||||
@@ -60,7 +61,6 @@ import nova.context
|
||||
from nova.db.sqlalchemy import models
|
||||
from nova import exception
|
||||
from nova.i18n import _, _LI, _LE, _LW
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import uuidutils
|
||||
from nova import quota
|
||||
|
||||
|
@@ -20,13 +20,13 @@ from migrate import exceptions as versioning_exceptions
|
||||
from migrate.versioning import api as versioning_api
|
||||
from migrate.versioning.repository import Repository
|
||||
from oslo_db.sqlalchemy import utils as db_utils
|
||||
from oslo_log import log as logging
|
||||
import sqlalchemy
|
||||
from sqlalchemy.sql import null
|
||||
|
||||
from nova.db.sqlalchemy import api as db_session
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
INIT_VERSION = 215
|
||||
_REPOSITORY = None
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db.sqlalchemy import utils as oslodbutils
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy.exc import OperationalError
|
||||
from sqlalchemy.ext.compiler import compiles
|
||||
from sqlalchemy import MetaData
|
||||
@@ -25,7 +26,6 @@ from sqlalchemy.types import NullType
|
||||
from nova.db.sqlalchemy import api as db
|
||||
from nova import exception
|
||||
from nova.i18n import _, _LE
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
|
@@ -14,7 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.openstack.common import log as logging
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import extra_specs_ops
|
||||
from nova.scheduler.filters import utils
|
||||
|
@@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.openstack.common import log as logging
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
|
13
nova/test.py
13
nova/test.py
@@ -26,7 +26,7 @@ eventlet.monkey_patch(os=False)
|
||||
|
||||
import copy
|
||||
import inspect
|
||||
import logging
|
||||
import logging as std_logging
|
||||
import mock
|
||||
import os
|
||||
|
||||
@@ -34,6 +34,8 @@ import fixtures
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslo_log.fixture import logging_error as log_fixture
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
from oslotest import moxstubout
|
||||
import six
|
||||
@@ -44,8 +46,6 @@ from nova import db
|
||||
from nova.network import manager as network_manager
|
||||
from nova import objects
|
||||
from nova.objects import base as objects_base
|
||||
from nova.openstack.common.fixture import logging as log_fixture
|
||||
from nova.openstack.common import log as nova_logging
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
from nova.tests.unit import conf_fixture
|
||||
from nova.tests.unit import policy_fixture
|
||||
@@ -54,9 +54,10 @@ from nova import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enabled', 'nova.api.openstack', group='osapi_v3')
|
||||
CONF.set_override('use_stderr', False)
|
||||
|
||||
nova_logging.setup('nova')
|
||||
logging.register_options(CONF)
|
||||
CONF.set_override('use_stderr', False)
|
||||
logging.setup(CONF, 'nova')
|
||||
|
||||
# NOTE(comstud): Make sure we have all of the objects loaded. We do this
|
||||
# at module import time, because we may be using mock decorators in our
|
||||
@@ -100,7 +101,7 @@ class TestingException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
class NullHandler(std_logging.Handler):
|
||||
"""custom default NullHandler to attempt to format the record.
|
||||
|
||||
Used in conjunction with
|
||||
|
@@ -18,7 +18,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import gettext
|
||||
import logging
|
||||
import logging as std_logging
|
||||
import os
|
||||
import uuid
|
||||
import warnings
|
||||
@@ -66,7 +66,7 @@ class TranslationFixture(fixtures.Fixture):
|
||||
self.gettext_patcher = self.useFixture(gettext_fixture)
|
||||
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
class NullHandler(std_logging.Handler):
|
||||
"""custom default NullHandler to attempt to format the record.
|
||||
|
||||
Used in conjunction with
|
||||
@@ -114,14 +114,14 @@ class StandardLogging(fixtures.Fixture):
|
||||
super(StandardLogging, self).setUp()
|
||||
|
||||
# set root logger to debug
|
||||
root = logging.getLogger()
|
||||
root.setLevel(logging.DEBUG)
|
||||
root = std_logging.getLogger()
|
||||
root.setLevel(std_logging.DEBUG)
|
||||
|
||||
# supports collecting debug level for local runs
|
||||
if os.environ.get('OS_DEBUG') in _TRUE_VALUES:
|
||||
level = logging.DEBUG
|
||||
level = std_logging.DEBUG
|
||||
else:
|
||||
level = logging.INFO
|
||||
level = std_logging.INFO
|
||||
|
||||
# Collect logs
|
||||
fs = '%(asctime)s %(levelname)s [%(name)s] %(message)s'
|
||||
@@ -132,15 +132,15 @@ class StandardLogging(fixtures.Fixture):
|
||||
# to the bottom of.
|
||||
root.handlers[0].setLevel(level)
|
||||
|
||||
if level > logging.DEBUG:
|
||||
if level > std_logging.DEBUG:
|
||||
# Just attempt to format debug level logs, but don't save them
|
||||
handler = NullHandler()
|
||||
self.useFixture(fixtures.LogHandler(handler, nuke_handlers=False))
|
||||
handler.setLevel(logging.DEBUG)
|
||||
handler.setLevel(std_logging.DEBUG)
|
||||
|
||||
# Don't log every single DB migration step
|
||||
logging.getLogger(
|
||||
'migrate.versioning.api').setLevel(logging.WARNING)
|
||||
std_logging.getLogger(
|
||||
'migrate.versioning.api').setLevel(std_logging.WARNING)
|
||||
|
||||
|
||||
class OutputStreamCapture(fixtures.Fixture):
|
||||
|
@@ -39,6 +39,7 @@ import netaddr
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
@@ -47,7 +48,6 @@ import six
|
||||
|
||||
from nova import exception
|
||||
from nova.i18n import _, _LE, _LW
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
notify_decorator = 'nova.notifications.notify_decorator'
|
||||
|
||||
|
@@ -16,7 +16,8 @@
|
||||
|
||||
import os
|
||||
|
||||
from nova.openstack.common import log as logging
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova import utils
|
||||
from nova.volume.encryptors import base
|
||||
|
||||
|
@@ -32,6 +32,7 @@ websockify>=0.6.0,<0.7
|
||||
oslo.concurrency>=1.4.1 # Apache-2.0
|
||||
oslo.config>=1.6.0 # Apache-2.0
|
||||
oslo.context>=0.1.0 # Apache-2.0
|
||||
oslo.log>=0.1.0 # Apache-2.0
|
||||
oslo.serialization>=1.2.0 # Apache-2.0
|
||||
oslo.utils>=1.2.0 # Apache-2.0
|
||||
oslo.db>=1.4.1 # Apache-2.0
|
||||
|
Reference in New Issue
Block a user