fix: register log options to allow context in logs
Adding oslo_log ContextFormatter registers additional options in the DEFAULT group that poppy ignores when loading the app. Fixes poppy worker not logging to the configured handler. Both poppy-server and poppy-worker should send logs to the same destination. Change-Id: Iba34f0c6f9e9dc2e23f7a1e9d2d89f8d3337129d
This commit is contained in:
parent
429d256ff9
commit
39f91aa3d8
@ -14,6 +14,12 @@ use_same_storage_driver = True
|
||||
# Show debugging output in logs (sets DEBUG log level output)
|
||||
;debug = False
|
||||
|
||||
# logging format that will be used with oslo_log.formatters.ContextFormatter
|
||||
# in logging.conf below
|
||||
logging_context_format_string = poppy %(levelname)s [%(request_id)s %(user_identity)s] %(message)s
|
||||
logging_default_format_string = poppy %(levelname)s [-] %(message)s
|
||||
logging_exception_prefix = poppy ERROR %(instance)s
|
||||
|
||||
# Log to this file
|
||||
log_file = poppy.log
|
||||
log_config_append = etc/logging.conf
|
||||
|
@ -76,14 +76,8 @@ class Bootstrap(object):
|
||||
self.conf = conf
|
||||
self.conf.register_opts(_DEFAULT_OPTIONS)
|
||||
self.conf.register_opts(_DRIVER_OPTIONS, group=_DRIVER_GROUP)
|
||||
try:
|
||||
getattr(self.conf, 'log_config_append')
|
||||
except cfg.NoSuchOptError:
|
||||
log_config_append_opt = cfg.StrOpt('log_config_append')
|
||||
self.conf.register_opt(log_config_append_opt)
|
||||
self.driver_conf = self.conf[_DRIVER_GROUP]
|
||||
|
||||
log.setup(self.conf, "poppy")
|
||||
LOG.debug("init bootstrap")
|
||||
|
||||
@decorators.lazy_property(write=False)
|
||||
|
@ -29,7 +29,7 @@ def run():
|
||||
conf = cfg.CONF
|
||||
log.register_options(conf)
|
||||
conf(project='poppy', prog='poppy')
|
||||
|
||||
log.setup(conf, 'poppy')
|
||||
server = bootstrap.Bootstrap(conf)
|
||||
|
||||
# The following code is to daemonize poppy-server to avoid
|
||||
|
@ -29,6 +29,7 @@ def run():
|
||||
conf = cfg.CONF
|
||||
log.register_options(conf)
|
||||
conf(project='poppy', prog='poppy')
|
||||
log.setup(conf, 'poppy')
|
||||
b = bootstrap.Bootstrap(conf)
|
||||
conductor_name = '{0}-{1}'.format(socket.gethostname(), os.getpid())
|
||||
b.distributed_task.services_controller.run_task_worker(name=conductor_name)
|
||||
|
@ -28,13 +28,19 @@ to the WSGI app when it is called from other apps.
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from poppy import bootstrap
|
||||
|
||||
|
||||
conf = cfg.CONF
|
||||
|
||||
log.register_options(conf)
|
||||
|
||||
conf(project='poppy', prog='poppy', args=[])
|
||||
if os.environ.get('POPPY_CONFIG_FILE') is not None:
|
||||
conf.default_config_files.insert(os.environ.get('POPPY_CONFIG_FILE'), 0)
|
||||
|
||||
log.setup(conf, "poppy")
|
||||
|
||||
app = bootstrap.Bootstrap(conf).transport.app
|
||||
|
Loading…
Reference in New Issue
Block a user