summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2014-11-01 20:00:56 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2014-11-01 20:00:56 (GMT)
commit1be0c618827c14dd3f813f38fb3c788e140e9b72 (patch)
tree195f098e63449cf30f30a737e25721421772ec3b /Lib/logging
parent8be6fac103b108c3bfac8e91a08ab2671c4537d3 (diff)
parentc33a0cc61ea763bde926b22492785f3b2b66685c (diff)
downloadcpython-1be0c618827c14dd3f813f38fb3c788e140e9b72.zip
cpython-1be0c618827c14dd3f813f38fb3c788e140e9b72.tar.gz
cpython-1be0c618827c14dd3f813f38fb3c788e140e9b72.tar.bz2
Closes #22776: Merged fix from 3.4.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index b371824..43cbb55 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -879,21 +879,21 @@ class SysLogHandler(logging.Handler):
The record is formatted, and then sent to the syslog server. If
exception information is present, it is NOT sent to the server.
"""
- msg = self.format(record)
- if self.ident:
- msg = self.ident + msg
- if self.append_nul:
- msg += '\000'
-
- # We need to convert record level to lowercase, maybe this will
- # change in the future.
- prio = '<%d>' % self.encodePriority(self.facility,
- self.mapPriority(record.levelname))
- prio = prio.encode('utf-8')
- # Message is a string. Convert to bytes as required by RFC 5424
- msg = msg.encode('utf-8')
- msg = prio + msg
try:
+ msg = self.format(record)
+ if self.ident:
+ msg = self.ident + msg
+ if self.append_nul:
+ msg += '\000'
+
+ # We need to convert record level to lowercase, maybe this will
+ # change in the future.
+ prio = '<%d>' % self.encodePriority(self.facility,
+ self.mapPriority(record.levelname))
+ prio = prio.encode('utf-8')
+ # Message is a string. Convert to bytes as required by RFC 5424
+ msg = msg.encode('utf-8')
+ msg = prio + msg
if self.unixsocket:
try:
self.socket.send(msg)