diff --git a/watcher/cmd/api.py b/watcher/cmd/api.py index 71c4a7c72..74fed0368 100644 --- a/watcher/cmd/api.py +++ b/watcher/cmd/api.py @@ -26,7 +26,7 @@ from oslo_log import log as logging from watcher._i18n import _ from watcher.api import app as api_app -from watcher import service +from watcher.common import service LOG = logging.getLogger(__name__) diff --git a/watcher/common/service.py b/watcher/common/service.py index dfbdea4e3..0f6055cfe 100644 --- a/watcher/common/service.py +++ b/watcher/common/service.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import signal import socket @@ -124,9 +125,10 @@ _DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'qpid.messaging=INFO', 'glanceclient=WARN', 'watcher.openstack.common=WARN'] -def prepare_service(argv=[]): - log.register_options(cfg.CONF) +def prepare_service(argv=[], conf=cfg.CONF): + log.register_options(conf) config.parse_args(argv) cfg.set_defaults(_options.log_opts, default_log_levels=_DEFAULT_LOG_LEVELS) - log.setup(cfg.CONF, 'python-watcher') + log.setup(conf, 'python-watcher') + conf.log_opt_values(LOG, logging.DEBUG) diff --git a/watcher/service.py b/watcher/service.py deleted file mode 100644 index a4f3302eb..000000000 --- a/watcher/service.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- encoding: utf-8 -*- -# Copyright (c) 2015 b<>com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import logging - -from oslo_config import cfg -from oslo_log import log - -LOG = log.getLogger(__name__) - - -def prepare_service(args=None, conf=cfg.CONF): - log.register_options(conf) - log.setup(conf, 'watcher') - conf(args, project='python-watcher') - conf.log_opt_values(LOG, logging.DEBUG)