Dump conf to debug log later in the WSGI app pipeline

When CONF.log_options = True, we dump the config to the DEBUG log and
it can help with debugging issues to see whether a config has been
applied or not. Currently, the log is dumped before other options in
the pipeline are registered, such as the keystonemiddleware.auth_token
options in the [keystone_authtoken] config section.

This moves the conf dumping code after the WSGI app is loaded in order
to reflect more config options in the debug log.

Change-Id: I53d36b68d7942bc65a85fbe314a7f0baa6124343
Signed-off-by: melanie witt <melwittt@gmail.com>
This commit is contained in:
melanie witt
2025-10-09 18:44:04 +00:00
parent 076498ed95
commit 45cdc1903b
+10 -6
View File
@@ -112,15 +112,10 @@ def init_global_data(conf_files, service_name):
gmr.TextGuruMeditation.setup_autorun(
version, conf=CONF, service_name=service_name)
# dump conf at debug (log_options option comes from oslo.service)
# FIXME(mriedem): This is gross but we don't have a public hook into
# oslo.service to register these options, so we are doing it manually for
# now; remove this when we have a hook method into oslo.service.
CONF.register_opts(service_opts.service_opts)
if CONF.log_options:
CONF.log_opt_values(
logging.getLogger(__name__),
logging.DEBUG)
@utils.latch_error_on_raise(retryable=(odbe.DBConnectionError,))
@@ -146,4 +141,13 @@ def init_application(name):
conf = conf_files[0]
return deploy.loadapp('config:%s' % conf, name=name)
app = deploy.loadapp('config:%s' % conf, name=name)
# We dump the conf after the WSGI app is loaded because some config options
# (such as the keystonemiddleware.auth_token options) are registered later
# in the pipeline.
if CONF.log_options:
# dump conf at debug (log_options option comes from oslo.service)
CONF.log_opt_values(
logging.getLogger(__name__),
logging.DEBUG)
return app