Use oslo.log library instead of system logging module

The constants of log levels were added in the 1.8 version of
the oslo.log library. So we can replace all usage of system
logging module with log module from oslo.log.

Change-Id: I2992df0bec6337aefa8a75d4853b132bd134fa42
Closes-Bug: 1481370
This commit is contained in:
Sergey Vilgelm 2015-08-10 15:46:27 +03:00
parent bbfd5cf486
commit 5ff3439df5
7 changed files with 11 additions and 20 deletions

View File

@ -22,7 +22,6 @@ import datetime
import errno
import functools
import hashlib
import logging as std_logging
import multiprocessing
import netaddr
import os
@ -282,7 +281,7 @@ def is_extension_supported(plugin, ext_alias):
def log_opt_values(log):
cfg.CONF.log_opt_values(log, std_logging.DEBUG)
cfg.CONF.log_opt_values(log, logging.DEBUG)
def get_random_mac(base_mac):

View File

@ -14,7 +14,6 @@
# under the License.
import hashlib
import logging as std_logging
import signal
import sys
import time
@ -1660,7 +1659,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
self.conf.reload_config_files()
config.setup_logging()
LOG.debug('Full set of CONF:')
self.conf.log_opt_values(LOG, std_logging.DEBUG)
self.conf.log_opt_values(LOG, logging.DEBUG)
self.catch_sighup = False
return self.run_daemon_loop

View File

@ -18,7 +18,6 @@ Policy engine for neutron. Largely copied from nova.
"""
import collections
import logging as std_logging
import re
from oslo_config import cfg
@ -314,7 +313,7 @@ def _prepare_check(context, action, target, pluralized):
def log_rule_list(match_rule):
if LOG.isEnabledFor(std_logging.DEBUG):
if LOG.isEnabledFor(logging.DEBUG):
rules = _process_rules_list([], match_rule)
LOG.debug("Enforcing rules: %s", rules)

View File

@ -13,7 +13,6 @@
# under the License.
import functools
import logging
import pprint
import alembic
@ -32,9 +31,6 @@ from neutron.db.migration import cli as migration
from neutron.db.migration.models import head as head_models
from neutron.tests.common import base
LOG = logging.getLogger(__name__)
cfg.CONF.import_opt('core_plugin', 'neutron.common.config')
CORE_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin'

View File

@ -15,7 +15,6 @@
from __future__ import print_function
import logging as std_logging
import os
from oslo_config import cfg
@ -1191,7 +1190,7 @@ class TempestConfigPrivate(object):
register_opts()
self._set_attrs()
if parse_conf:
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
cfg.CONF.log_opt_values(LOG, logging.DEBUG)
class TempestConfigProxy(object):
@ -1199,15 +1198,15 @@ class TempestConfigProxy(object):
_path = None
_extra_log_defaults = [
('keystoneclient.session', std_logging.INFO),
('paramiko.transport', std_logging.INFO),
('requests.packages.urllib3.connectionpool', std_logging.WARN),
('keystoneclient.session', logging.INFO),
('paramiko.transport', logging.INFO),
('requests.packages.urllib3.connectionpool', logging.WARN),
]
def _fix_log_levels(self):
"""Tweak the oslo log defaults."""
for name, level in self._extra_log_defaults:
std_logging.getLogger(name).setLevel(level)
logging.getLogger(name).logger.setLevel(level)
def __getattr__(self, attr):
if not self._config:

View File

@ -14,9 +14,9 @@
# under the License.
import fixtures
import logging as std_logging
import mock
from oslo_db import exception as exc
from oslo_log import log as logging
from sqlalchemy.orm import query
import neutron.db.api as db
@ -47,7 +47,7 @@ class HelpersTest(testlib_api.SqlTestCase):
fixtures.FakeLogger(
name=helpers.__name__,
format=base.LOG_FORMAT,
level=std_logging.DEBUG
level=logging.DEBUG
))
def check_raw_segment(self, expected, observed):

View File

@ -19,7 +19,6 @@ Utility methods for working with WSGI servers
from __future__ import print_function
import errno
import logging as std_logging
import os
import socket
import ssl
@ -240,7 +239,7 @@ class Server(object):
# The API service should run in the current process.
self._server = service
# Dump the initial option values
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
cfg.CONF.log_opt_values(LOG, logging.DEBUG)
service.start()
systemd.notify_once()
else: