Skip to content

Commit

Permalink
Correct the position of the syslog handler
Browse files Browse the repository at this point in the history
Correct the position of the syslog handler,
then the syslog handler can have same settings with
other handlers.

Change-Id: I15163f1dd12713c71d42efdb128f8d12ec5dc307
Closes-Bug: #1399088
  • Loading branch information
iamhappg committed Dec 20, 2014
1 parent 6301575 commit 250315b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions oslo_log/log.py
Expand Up @@ -230,6 +230,20 @@ def _setup_logging_from_conf(conf, project, version):
logging.ERROR)
log_root.addHandler(handler)

if conf.use_syslog:
try:
facility = _find_facility_from_conf(conf)
# TODO(bogdando) use the format provided by RFCSysLogHandler
# after existing syslog format deprecation in J
if conf.use_syslog_rfc_format:
syslog = handlers.RFCSysLogHandler(facility=facility)
else:
syslog = logging.handlers.SysLogHandler(facility=facility)
log_root.addHandler(syslog)
except socket.error:
log_root.error('Unable to add syslog handler. Verify that syslog '
'is running.')

datefmt = conf.log_date_format
for handler in log_root.handlers:
# NOTE(alaski): CONF.log_format overrides everything currently. This
Expand Down Expand Up @@ -263,21 +277,6 @@ def _setup_logging_from_conf(conf, project, version):
else:
logger.setLevel(level_name)

if conf.use_syslog:
try:
facility = _find_facility_from_conf(conf)
# TODO(bogdando) use the format provided by RFCSysLogHandler
# after existing syslog format deprecation in J
if conf.use_syslog_rfc_format:
syslog = handlers.RFCSysLogHandler(facility=facility)
else:
syslog = logging.handlers.SysLogHandler(facility=facility)
log_root.addHandler(syslog)
except socket.error:
log_root.error('Unable to add syslog handler. Verify that syslog '
'is running.')


_loggers = {}


Expand Down

0 comments on commit 250315b

Please sign in to comment.