Kaydet (Commit) 1b038e07 authored tarafından Коренберг Марк's avatar Коренберг Марк Kaydeden (comit) Vinay Sajip

bpo-29808: SysLogHandler: Do not fail if initial connect to syslog failed (#663) (#663)

üst 3f2155ff
...@@ -815,7 +815,14 @@ class SysLogHandler(logging.Handler): ...@@ -815,7 +815,14 @@ class SysLogHandler(logging.Handler):
if isinstance(address, str): if isinstance(address, str):
self.unixsocket = True self.unixsocket = True
self._connect_unixsocket(address) # Syslog server may be unavailable during handler initialisation.
# C's openlog() function also ignores connection errors.
# Moreover, we ignore these errors while logging, so it not worse
# to ignore it also here.
try:
self._connect_unixsocket(address)
except OSError:
pass
else: else:
self.unixsocket = False self.unixsocket = False
if socktype is None: if socktype is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment