Merge "Allow log statements to be printed out in stdout"

This commit is contained in:
Jenkins 2015-11-18 16:28:40 +00:00 committed by Gerrit Code Review
commit b9072e8c0a
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,31 @@
# Copyright (c) 2015 IBM
# All Rights Reserved.
#
# 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.
from oslo_config import cfg
from oslo_log import log
CONF = cfg.CONF
_DEFAULT_LOG_LEVELS = ['castellan=WARN']
_DEFAULT_LOGGING_CONTEXT_FORMAT = ('%(asctime)s.%(msecs)03d %(process)d '
'%(levelname)s %(name)s [%(request_id)s '
'%(user_identity)s] %(instance)s'
'%(message)s')
def configure_logging():
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
log.register_options(CONF)

View File

@ -13,7 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from castellan.common import config
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
key_manager_opts = [
@ -25,8 +28,11 @@ key_manager_opts = [
def API(configuration=None):
conf = configuration or cfg.CONF
conf = configuration or config.CONF
conf.register_opts(key_manager_opts, group='key_manager')
config.configure_logging()
logging.setup(conf, "castellan")
cls = importutils.import_class(conf.key_manager.api_class)
return cls(configuration=conf)