summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorКоренберг Марк <socketpair@gmail.com>2017-03-17 15:25:05 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2017-03-17 15:25:05 (GMT)
commit1b038e073807ecb6fd176edaf3386a8e3205416e (patch)
treec7fba9ffd0e320df651ef4baab1b7ba6c3225056 /Lib
parent3f2155ffe683080f2a1b28408fa48d43ba92f943 (diff)
downloadcpython-1b038e073807ecb6fd176edaf3386a8e3205416e.zip
cpython-1b038e073807ecb6fd176edaf3386a8e3205416e.tar.gz
cpython-1b038e073807ecb6fd176edaf3386a8e3205416e.tar.bz2
bpo-29808: SysLogHandler: Do not fail if initial connect to syslog failed (#663) (#663)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/handlers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 7d77973..2356f8d 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -815,7 +815,14 @@ class SysLogHandler(logging.Handler):
if isinstance(address, str):
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:
self.unixsocket = False
if socktype is None: