From 128fd28bd79c51d209da8c27885971c1fb18c095 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Mon, 13 Nov 2017 14:52:09 -0500 Subject: [PATCH] Log options at debug when starting API services under wsgi The ServiceLauncher and ProcessLauncher in oslo.service will, by default, log config options at DEBUG level at the start of a service, which is what would happen when starting nova-api using eventlet. Running nova-api under wsgi has been supported since Pike, but the wsgi app code doesn't log the debug options like oslo.service would, so this adds that back in. The placement-api wsgi app code would log the options but based on whether or not debug logging is enabled, which is different from how it works in oslo.service, so the config option that is checked is changed in this patch, and a release note is added for that subtle behavior change. Closes-Bug: #1732000 Change-Id: I680fd9761a049cac619b7793fa5c60e6daf4fa47 --- nova/api/openstack/placement/wsgi.py | 9 +++++++-- .../notes/bug-1732000-log-options-6db2cc8c747145ca.yaml | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1732000-log-options-6db2cc8c747145ca.yaml diff --git a/nova/api/openstack/placement/wsgi.py b/nova/api/openstack/placement/wsgi.py index c982f90f9..599517e46 100644 --- a/nova/api/openstack/placement/wsgi.py +++ b/nova/api/openstack/placement/wsgi.py @@ -19,6 +19,7 @@ import os import os.path from oslo_log import log as logging +from oslo_service import _options as service_opts from nova.api.openstack.placement import deploy from nova import conf @@ -55,8 +56,12 @@ def init_application(): # initialize the logging system setup_logging(conf.CONF) - # dump conf if we're at debug - if conf.CONF.debug: + # 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.CONF.register_opts(service_opts.service_opts) + if conf.CONF.log_options: conf.CONF.log_opt_values( logging.getLogger(__name__), logging.DEBUG) diff --git a/releasenotes/notes/bug-1732000-log-options-6db2cc8c747145ca.yaml b/releasenotes/notes/bug-1732000-log-options-6db2cc8c747145ca.yaml new file mode 100644 index 000000000..e3cbfbeff --- /dev/null +++ b/releasenotes/notes/bug-1732000-log-options-6db2cc8c747145ca.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + The ``[DEFAULT]/log_options`` configuration option can be used to log + configuration options at DEBUG level when the `placement-api` and/or + `nova-api` services are started under WSGI. The default behavior is to + log options on startup.