Add facility to configure log levels in promenade
Add 'INFO' as default log level.Create logging section in /etc/promenade/promenade.conf. Set log_level key in the logging section of promenade.conf to override the default log level.The allowed log_level values are as follows: 1. 'DEBUG' 2. 'INFO' 3. 'WARNING' 4. 'ERROR' 5. 'CRITICAL' Add log_level under logging section in promenade charts values.yaml. Change-Id: I9bbd36e04bbac96779d3f198b0484176e0045a4e
This commit is contained in:
parent
b417f422e9
commit
d50735681a
@ -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$
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
sphinx>=1.6.2
|
||||
sphinx_rtd_theme==0.2.4
|
||||
falcon==1.2.0
|
||||
oslo.config==6.6.2
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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'),
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user