1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

add some exception handling for dealing with logging connection resets

when rsyslogd restarts due to config changes, there's a brief moment
where the socket will refuse connections on teardown; exception handling
is needed here to deal with that
This commit is contained in:
Ryan Petrello 2020-04-09 13:58:48 -04:00 committed by Christian Adams
parent 1000dc10fb
commit b0db2b7bec

View File

@ -18,7 +18,14 @@ class RSysLogHandler(logging.handlers.SysLogHandler):
return
if not os.path.exists(settings.LOGGING['handlers']['external_logger']['address']):
return
return super(RSysLogHandler, self).emit(msg)
try:
return super(RSysLogHandler, self).emit(msg)
except ConnectionRefusedError:
# rsyslogd has gone to lunch; this generally means that it's just
# been restarted (due to a configuration change)
# unfortunately, we can't log that because...rsyslogd is down (and
# would just us back ddown this code path)
pass
ColorHandler = logging.StreamHandler