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
This commit is contained in:
Matt Riedemann 2017-11-13 14:52:09 -05:00 committed by Chris Dent
parent c1442d3c8c
commit 53dc0917c5
3 changed files with 25 additions and 2 deletions

View File

@ -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)

View File

@ -15,6 +15,7 @@ import os
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import _options as service_opts
from paste import deploy
from nova import config
@ -84,6 +85,16 @@ def init_application(name):
service.setup_profiler(name, CONF.host)
# 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)
conf = conf_files[0]
return deploy.loadapp('config:%s' % conf, name=name)

View File

@ -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.