From 45cdc1903b23646dcd8b1d4b23cfbb3ba62c8c4a Mon Sep 17 00:00:00 2001 From: melanie witt Date: Thu, 9 Oct 2025 18:44:04 +0000 Subject: [PATCH] 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 --- nova/api/openstack/wsgi_app.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nova/api/openstack/wsgi_app.py b/nova/api/openstack/wsgi_app.py index 648d529e5f..9e5d911ffe 100644 --- a/nova/api/openstack/wsgi_app.py +++ b/nova/api/openstack/wsgi_app.py @@ -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