From f3eb9479e2e8ffd903b9ccb5ab8dff6b10b7194d Mon Sep 17 00:00:00 2001 From: Anusha Ramineni Date: Fri, 13 Jan 2017 08:54:01 +0530 Subject: [PATCH] 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: Ide50502f020eb1309648f4f9fc8a9c17aa1a1d9c --- tempest/api/compute/volumes/test_attach_volume.py | 2 +- tempest/config.py | 9 ++++----- tempest/lib/cli/base.py | 2 +- tempest/lib/cli/output_parser.py | 3 ++- tempest/lib/common/rest_client.py | 3 +-- tempest/lib/services/clients.py | 3 ++- tempest/test_discover/plugins.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py index 30549ecdb5..fa465af64c 100644 --- a/tempest/api/compute/volumes/test_attach_volume.py +++ b/tempest/api/compute/volumes/test_attach_volume.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import logging +from oslo_log import log as logging import testtools from tempest.api.compute import base diff --git a/tempest/config.py b/tempest/config.py index 4162718034..a394955013 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -16,7 +16,6 @@ from __future__ import print_function import functools -import logging as std_logging import os import tempfile @@ -1196,7 +1195,7 @@ class TempestConfigPrivate(object): register_opts() self._set_attrs() if parse_conf: - _CONF.log_opt_values(LOG, std_logging.DEBUG) + _CONF.log_opt_values(LOG, logging.DEBUG) class TempestConfigProxy(object): @@ -1204,14 +1203,14 @@ class TempestConfigProxy(object): _path = None _extra_log_defaults = [ - ('paramiko.transport', std_logging.INFO), - ('requests.packages.urllib3.connectionpool', std_logging.WARN), + ('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: diff --git a/tempest/lib/cli/base.py b/tempest/lib/cli/base.py index 5d7fbe3aab..5468a7bcdf 100644 --- a/tempest/lib/cli/base.py +++ b/tempest/lib/cli/base.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -import logging import os import shlex import subprocess +from oslo_log import log as logging import six from tempest.lib import base diff --git a/tempest/lib/cli/output_parser.py b/tempest/lib/cli/output_parser.py index c71c7a74b0..716f374804 100644 --- a/tempest/lib/cli/output_parser.py +++ b/tempest/lib/cli/output_parser.py @@ -15,9 +15,10 @@ """Collection of utilities for parsing CLI clients output.""" -import logging import re +from oslo_log import log as logging + from tempest.lib import exceptions diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py index 31d2ba51b5..b49f3317fa 100644 --- a/tempest/lib/common/rest_client.py +++ b/tempest/lib/common/rest_client.py @@ -16,7 +16,6 @@ import collections import email.utils -import logging as real_logging import re import time @@ -455,7 +454,7 @@ class RestClient(object): # Also look everything at DEBUG if you want to filter this # out, don't run at debug. - if self.LOG.isEnabledFor(real_logging.DEBUG): + if self.LOG.isEnabledFor(logging.DEBUG): self._log_request_full(resp, req_headers, req_body, resp_body, extra) diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py index 262a894ff7..6542f07b8f 100644 --- a/tempest/lib/services/clients.py +++ b/tempest/lib/services/clients.py @@ -17,7 +17,8 @@ import copy import importlib import inspect -import logging + +from oslo_log import log as logging from tempest.lib import auth from tempest.lib.common.utils import misc diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py index e9f59af854..abe2b73d54 100644 --- a/tempest/test_discover/plugins.py +++ b/tempest/test_discover/plugins.py @@ -13,8 +13,8 @@ # under the License. import abc -import logging +from oslo_log import log as logging import six import stevedore