diff --git a/venus/api/common.py b/venus/api/common.py index 4afc037..c7c5d34 100644 --- a/venus/api/common.py +++ b/venus/api/common.py @@ -16,19 +16,18 @@ import os import re import enum -from oslo_log import log as logging + from six.moves import urllib import webob from venus.api.openstack import wsgi from venus.api import xmlutil +from venus.common.utils import LOG from venus.conf import CONF from venus.i18n import _ from venus import utils -LOG = logging.getLogger(__name__) - XML_NS_V1 = 'https://www.openstack.org/mediawiki/Venus/1.0/content' METADATA_TYPES = enum.Enum('METADATA_TYPES', 'user image') diff --git a/venus/api/contrib/__init__.py b/venus/api/contrib/__init__.py index 0cc7f9a..52d300b 100644 --- a/venus/api/contrib/__init__.py +++ b/venus/api/contrib/__init__.py @@ -18,15 +18,11 @@ It can't be called 'extensions' because that causes namespacing problems. """ -from oslo_log import log as logging - from venus.api import extensions +from venus.common.utils import LOG from venus.conf import CONF -LOG = logging.getLogger(__name__) - - def standard_extensions(ext_mgr): extensions.load_standard_extensions(ext_mgr, LOG, __path__, __package__) diff --git a/venus/api/extensions.py b/venus/api/extensions.py index b9097e4..db41dff 100644 --- a/venus/api/extensions.py +++ b/venus/api/extensions.py @@ -13,21 +13,18 @@ # under the License. import os -from oslo_log import log as logging from oslo_utils import importutils import webob.dec import webob.exc from venus.api.openstack import wsgi from venus.api import xmlutil +from venus.common.utils import LOG from venus.conf import CONF from venus import exception from venus.i18n import _LE, _LI, _LW -LOG = logging.getLogger(__name__) - - class ExtensionDescriptor(object): """Base class that defines the contract for extensions. diff --git a/venus/api/middleware/auth.py b/venus/api/middleware/auth.py index fbf9c50..059330b 100644 --- a/venus/api/middleware/auth.py +++ b/venus/api/middleware/auth.py @@ -20,22 +20,19 @@ Common Auth Middleware. import os -from oslo_log import log as logging from oslo_middleware import request_id from oslo_serialization import jsonutils import webob.dec import webob.exc from venus.api.openstack import wsgi +from venus.common.utils import LOG from venus.conf import CONF from venus import context from venus.i18n import _ from venus.wsgi import common as base_wsgi -LOG = logging.getLogger(__name__) - - def pipeline_factory(loader, global_conf, **local_conf): """A paste pipeline replica that keys off of auth_strategy.""" pipeline = local_conf[CONF.auth_strategy] diff --git a/venus/api/middleware/env.py b/venus/api/middleware/env.py index 51057d4..c6a6b4d 100644 --- a/venus/api/middleware/env.py +++ b/venus/api/middleware/env.py @@ -13,12 +13,12 @@ # under the License. from http import client -from oslo_log import log as logging - import webob.dec import webob.exc +from venus.common.utils import LOG + from venus import exception from venus.wsgi import common as base_wsgi @@ -27,7 +27,6 @@ from oslo_serialization import jsonutils import functools -LOG = logging.getLogger(__name__) JSON_ENCODE_CONTENT_TYPES = {'application/json', 'application/json-home'} diff --git a/venus/api/middleware/fault.py b/venus/api/middleware/fault.py index 0b15ec8..443bf18 100644 --- a/venus/api/middleware/fault.py +++ b/venus/api/middleware/fault.py @@ -12,20 +12,17 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging import webob.dec import webob.exc from venus.api.openstack import wsgi +from venus.common.utils import LOG from venus import exception from venus.i18n import _, _LI from venus import utils from venus.wsgi import common as base_wsgi -LOG = logging.getLogger(__name__) - - class FaultWrapper(base_wsgi.Middleware): """Calls down the middleware stack, making exceptions into faults.""" diff --git a/venus/api/openstack/wsgi.py b/venus/api/openstack/wsgi.py index b9a87e3..a90d74c 100644 --- a/venus/api/openstack/wsgi.py +++ b/venus/api/openstack/wsgi.py @@ -22,12 +22,11 @@ import webob from xml.dom import minidom from xml.parsers import expat -from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import encodeutils from oslo_utils import excutils - +from venus.common.utils import LOG from venus import exception from venus import i18n from venus.i18n import _, _LE, _LI @@ -38,7 +37,6 @@ from venus.wsgi import common as wsgi XML_NS_V1 = 'https://www.openstack.org/mediawiki/Venus/1.0/content' XML_NS_ATOM = 'http://www.w3.org/2005/Atom' -LOG = logging.getLogger(__name__) SUPPORTED_CONTENT_TYPES = ( 'application/json', diff --git a/venus/cmd/manage.py b/venus/cmd/manage.py index c01be49..f1b803a 100644 --- a/venus/cmd/manage.py +++ b/venus/cmd/manage.py @@ -38,8 +38,6 @@ from venus import version i18n.enable_lazy() -LOG = logging.getLogger(__name__) - # Decorators for actions def args(*args, **kwargs): diff --git a/venus/context.py b/venus/context.py index 9d5ddb0..713f433 100644 --- a/venus/context.py +++ b/venus/context.py @@ -17,16 +17,13 @@ import copy from oslo_context import context -from oslo_log import log as logging from oslo_utils import timeutils +from venus.common.utils import LOG from venus.conf import CONF from venus.i18n import _, _LW -LOG = logging.getLogger(__name__) - - class RequestContext(context.RequestContext): """Security context and request information. diff --git a/venus/db/sqlalchemy/api.py b/venus/db/sqlalchemy/api.py index f5342bc..dfad529 100644 --- a/venus/db/sqlalchemy/api.py +++ b/venus/db/sqlalchemy/api.py @@ -18,7 +18,6 @@ import sys import warnings from oslo_db import options -from oslo_log import log as logging from venus.conf import CONF from venus.db.common import _create_facade_lazily @@ -27,7 +26,6 @@ from venus.i18n import _ CONF.import_group("profiler", "venus.service") -log = logging.getLogger(__name__) options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite') diff --git a/venus/exception.py b/venus/exception.py index 94b98de..9fc1113 100644 --- a/venus/exception.py +++ b/venus/exception.py @@ -22,18 +22,15 @@ SHOULD include dedicated exception logging. import sys -from oslo_log import log as logging from oslo_versionedobjects import exception as obj_exc import six import webob.exc +from venus.common.utils import LOG from venus.conf import CONF from venus.i18n import _, _LE -LOG = logging.getLogger(__name__) - - class ConvertedException(webob.exc.WSGIHTTPException): def __init__(self, code=500, title="", explanation=""): self.code = code diff --git a/venus/modules/custom_config/action.py b/venus/modules/custom_config/action.py index c4b8bfa..2b43a01 100644 --- a/venus/modules/custom_config/action.py +++ b/venus/modules/custom_config/action.py @@ -12,11 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging from venus.modules.custom_config.backends.sql import CustomConfigSql -LOG = logging.getLogger(__name__) - class CustomConfigCore(object): def __init__(self): diff --git a/venus/modules/custom_config/backends/sql.py b/venus/modules/custom_config/backends/sql.py index 7b3a2f8..de174b5 100644 --- a/venus/modules/custom_config/backends/sql.py +++ b/venus/modules/custom_config/backends/sql.py @@ -16,14 +16,12 @@ import time from oslo_db import options -from oslo_log import log as logging from venus.conf import CONF from venus.db.common import _create_facade_lazily from venus.modules.custom_config.backends import models CONF.import_group("profiler", "venus.service") -log = logging.getLogger(__name__) options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite') diff --git a/venus/modules/custom_config/controller.py b/venus/modules/custom_config/controller.py index cb1cbc0..893b994 100644 --- a/venus/modules/custom_config/controller.py +++ b/venus/modules/custom_config/controller.py @@ -14,14 +14,9 @@ """The template api.""" -from oslo_log import log as logging - from venus.api.openstack import wsgi - from venus.modules.custom_config.action import CustomConfigCore -LOG = logging.getLogger(__name__) - class CustomConfigController(wsgi.Controller): def __init__(self, ext_mgr): diff --git a/venus/modules/search/action.py b/venus/modules/search/action.py index 8c39a13..54d7e47 100644 --- a/venus/modules/search/action.py +++ b/venus/modules/search/action.py @@ -16,15 +16,12 @@ import datetime import json import time -from oslo_log import log as logging from oslo_utils import timeutils from venus.common import utils from venus.conf import CONF from venus.modules.search import es_template -LOG = logging.getLogger(__name__) - class SearchCore(object): def __init__(self): @@ -39,7 +36,7 @@ class SearchCore(object): index_names = [] status, indexes = utils.request_es(url, 'GET') if status != 200: - LOG.error("failed to get all es indexes") + utils.LOG.error("failed to get all es indexes") return "" indexes_array = json.loads(indexes) for index in indexes_array: diff --git a/venus/modules/search/controller.py b/venus/modules/search/controller.py index f8fd7a3..57155b9 100644 --- a/venus/modules/search/controller.py +++ b/venus/modules/search/controller.py @@ -14,14 +14,10 @@ """The template api.""" -from oslo_log import log as logging - from venus.api.openstack import wsgi from venus.modules.search.action import SearchCore from venus.modules.search.search_lib import ESSearchObj -LOG = logging.getLogger(__name__) - class SearchController(wsgi.Controller): def __init__(self, ext_mgr): diff --git a/venus/modules/search/search_lib.py b/venus/modules/search/search_lib.py index 7d3f491..1d4fb83 100644 --- a/venus/modules/search/search_lib.py +++ b/venus/modules/search/search_lib.py @@ -18,12 +18,9 @@ from elasticsearch import Elasticsearch import re from urllib.parse import urlparse -from oslo_log import log as logging - +from venus.common.utils import LOG from venus.conf import CONF -LOG = logging.getLogger(__name__) - class ESSearchObj(object): diff --git a/venus/objects/base.py b/venus/objects/base.py index a24e65d..5e70f61 100644 --- a/venus/objects/base.py +++ b/venus/objects/base.py @@ -17,15 +17,14 @@ import contextlib import datetime -from oslo_log import log as logging from oslo_versionedobjects import base from oslo_versionedobjects import fields +from venus.common.utils import LOG from venus import exception from venus import objects -LOG = logging.getLogger('object') remotable = base.remotable remotable_classmethod = base.remotable_classmethod obj_make_list = base.obj_make_list diff --git a/venus/service.py b/venus/service.py index bf5bd2c..d0ecb39 100644 --- a/venus/service.py +++ b/venus/service.py @@ -20,7 +20,6 @@ import os import random from oslo_concurrency import processutils -from oslo_log import log as logging from oslo_service import loopingcall from oslo_service import service from oslo_utils import importutils @@ -28,6 +27,7 @@ import osprofiler.notifier from osprofiler import profiler import osprofiler.web +from venus.common.utils import LOG from venus.conf import CONF from venus import context from venus import exception @@ -37,9 +37,6 @@ from venus.wsgi import common as wsgi_common from venus.wsgi import eventlet_server as wsgi -LOG = logging.getLogger(__name__) - - def setup_profiler(binary, host): if CONF.profiler.profiler_enabled: LOG.warning( diff --git a/venus/task/adapter.py b/venus/task/adapter.py index 646e0c2..7a25772 100644 --- a/venus/task/adapter.py +++ b/venus/task/adapter.py @@ -13,12 +13,8 @@ # under the License. """A Timer Task With APScheduler.""" - -from oslo_log import log as logging from venus.task.core import delete_es_index_task -LOG = logging.getLogger(__name__) - def delete_es_index_job(): job = delete_es_index_task.DeleteESIndexTask() diff --git a/venus/task/backends/sql.py b/venus/task/backends/sql.py index ff5bc6c..304142c 100644 --- a/venus/task/backends/sql.py +++ b/venus/task/backends/sql.py @@ -17,8 +17,8 @@ import socket import time from oslo_db import options -from oslo_log import log as logging +from venus.common.utils import LOG from venus.conf import CONF from venus.db.common import _create_facade_lazily from venus.i18n import _LE @@ -26,7 +26,6 @@ from venus.task.backends import models # abc CONF.import_group("profiler", "venus.service") -log = logging.getLogger(__name__) options.set_defaults(CONF, connection='sqlite:///$state_path/venus.sqlite') @@ -44,7 +43,7 @@ class TaskSql(object): tasks = session.query(models.RegitsterTask).filter_by( task_name=t_name).with_lockmode('update').all() if len(tasks) != 1: - log.error(_LE("unsupported task type:%s, please check it"), + LOG.error(_LE("unsupported task type:%s, please check it"), t_name) return False diff --git a/venus/task/core/delete_es_index_task.py b/venus/task/core/delete_es_index_task.py index de4325b..ef6f9c1 100644 --- a/venus/task/core/delete_es_index_task.py +++ b/venus/task/core/delete_es_index_task.py @@ -16,11 +16,8 @@ import datetime import six import time - -from oslo_log import log as logging - - from venus.common import utils +from venus.common.utils import LOG from venus.conf import CONF from venus.modules.custom_config.backends.sql import CustomConfigSql from venus.modules.search.search_lib import ESSearchObj @@ -28,8 +25,6 @@ from venus.i18n import _LE, _LI from venus.task.backends.sql import TaskSql -LOG = logging.getLogger(__name__) - TASK_NAME = "delete_es_index" diff --git a/venus/task/timer.py b/venus/task/timer.py index a272810..d28e9ca 100644 --- a/venus/task/timer.py +++ b/venus/task/timer.py @@ -14,10 +14,8 @@ """A Timer Task With APScheduler.""" from apscheduler.schedulers.blocking import BlockingScheduler -from oslo_log import log as logging from venus.task import adapter -LOG = logging.getLogger(__name__) sched = BlockingScheduler() diff --git a/venus/wsgi/common.py b/venus/wsgi/common.py index 35a2043..8b51d57 100644 --- a/venus/wsgi/common.py +++ b/venus/wsgi/common.py @@ -20,15 +20,12 @@ import sys import webob.dec import webob.exc -from oslo_log import log as logging - +from venus.common.utils import LOG from venus.conf import CONF from venus import exception from venus.i18n import _, _LE from venus import utils -LOG = logging.getLogger(__name__) - class Request(webob.Request): pass diff --git a/venus/wsgi/eventlet_server.py b/venus/wsgi/eventlet_server.py index 6e651b0..2af37bd 100644 --- a/venus/wsgi/eventlet_server.py +++ b/venus/wsgi/eventlet_server.py @@ -25,19 +25,18 @@ import time import eventlet import eventlet.wsgi import greenlet + from oslo_log import log as logging from oslo_service import service from oslo_utils import excutils from oslo_utils import netutils +from venus.common.utils import LOG from venus.conf import CONF from venus import exception from venus.i18n import _, _LE, _LI -LOG = logging.getLogger(__name__) - - class Server(service.ServiceBase): """Server class to manage a WSGI server, serving a WSGI application."""