Make use_syslog=True log to syslog via /dev/log

After upgrade from Icehouse to Juno OpenStack services don't log to
syslog via /dev/log anymore. This behaviour was introduced in commit
1188d88a73e75da5c143d0dfad34e10dad0daee0. While /dev/log is arguably
not a very portable default, breaking the backwards compatibility is
even worse.
This commit restores the original behaviour. /dev/log portability
issues will be addressed separately.
Closes-Bug: #1385295
Related-Bug: #1391428

Change-Id: I5c450595fde7451a5bf9372430a53e75dd5773a3
This commit is contained in:
John Stanford 2015-02-26 12:47:16 -08:00
parent 5139941a0c
commit 2bf8164a90

View File

@ -285,9 +285,11 @@ def _setup_logging_from_conf(conf, project, version):
# TODO(bogdando) use the format provided by RFCSysLogHandler # TODO(bogdando) use the format provided by RFCSysLogHandler
# after existing syslog format deprecation in J # after existing syslog format deprecation in J
if conf.use_syslog_rfc_format: if conf.use_syslog_rfc_format:
syslog = handlers.RFCSysLogHandler(facility=facility) syslog = handlers.RFCSysLogHandler(address='/dev/log',
facility=facility)
else: else:
syslog = logging.handlers.SysLogHandler(facility=facility) syslog = logging.handlers.SysLogHandler(address='/dev/log',
facility=facility)
log_root.addHandler(syslog) log_root.addHandler(syslog)
except socket.error: except socket.error:
log_root.error('Unable to add syslog handler. Verify that syslog ' log_root.error('Unable to add syslog handler. Verify that syslog '