Merge "Add facility to configure log levels in promenade"

This commit is contained in:
Zuul 2019-08-07 18:43:57 +00:00 committed by Gerrit Code Review
commit 4735ecfd7f
6 changed files with 24 additions and 3 deletions

View File

@ -83,7 +83,7 @@
description: |
Executes unit tests under Python 3.5
run: tools/zuul/playbooks/make-tests.yaml
timeout: 300
timeout: 1500
nodeset: airship-promenade-single-node
files:
- ^.*\.py$

View File

@ -14,6 +14,11 @@
conf:
promenade:
logging:
# Which messages to log.
# Valid values include 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'.
# Default value is 'DEBUG'.
log_level: 'DEBUG'
keystone_authtoken:
delay_auth_decision: true
auth_type: password

View File

@ -1,3 +1,4 @@
sphinx>=1.6.2
sphinx_rtd_theme==0.2.4
falcon==1.2.0
oslo.config==6.6.2

View File

@ -1,6 +1,7 @@
import copy
import logging
import logging.config
from oslo_config import cfg
__all__ = ['getLogger', 'setup']
@ -45,7 +46,7 @@ DEFAULT_CONFIG = {
},
'promenade': {
'handlers': ['default'],
'level': 'INFO',
'level': 'DEBUG',
'propagate': False,
},
},
@ -79,8 +80,12 @@ class Adapter(logging.LoggerAdapter):
def setup(*, verbose):
log_config = copy.deepcopy(DEFAULT_CONFIG)
if verbose:
log_config['loggers']['promenade']['level'] = 'DEBUG'
else:
log_level = cfg.CONF.logging.log_level
log_config['loggers']['promenade']['level'] = log_level
logging.config.dictConfig(log_config)

View File

@ -7,6 +7,16 @@ OPTIONS = []
def setup(disable_keystone=False):
cfg.CONF([], project='promenade')
cfg.CONF.register_opts(OPTIONS)
log_group = cfg.OptGroup(name='logging', title='Logging options')
cfg.CONF.register_group(log_group)
logging_options = [
cfg.StrOpt(
'log_level',
choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
default='DEBUG',
help='Global log level for PROMENADE')
]
cfg.CONF.register_opts(logging_options, group=log_group)
if disable_keystone is False:
cfg.CONF.register_opts(
keystoneauth1.loading.get_auth_plugin_conf_options('password'),

View File

@ -21,7 +21,7 @@ def start_promenade(disable=False):
options.setup(disable_keystone=disable)
# Setup root logger
logging.setup(verbose=True)
logging.setup(verbose=False)
# Setup policy
policy.policy_engine = policy.PromenadePolicy()