summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-09-03 09:06:07 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-09-03 09:06:07 (GMT)
commite900b494cb8cd75eb54ec105cd120476fed0a1be (patch)
tree614a2b79ba4d1a36061e92a639dcc77bf24baf73 /Lib/logging
parenta1e627d61c57fefbfdabf308b33de75e08ca5374 (diff)
downloadcpython-e900b494cb8cd75eb54ec105cd120476fed0a1be.zip
cpython-e900b494cb8cd75eb54ec105cd120476fed0a1be.tar.gz
cpython-e900b494cb8cd75eb54ec105cd120476fed0a1be.tar.bz2
Issue #7077: Backported fix from py3k.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 38beb10..472eee5 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -786,20 +786,19 @@ 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)
+ msg = self.format(record) + '\000'
"""
We need to convert record level to lowercase, maybe this will
change in the future.
"""
- msg = self.log_format_string % (
- self.encodePriority(self.facility,
- self.mapPriority(record.levelname)),
- msg)
- # Treat unicode messages as required by RFC 5424
- if _unicode and type(msg) is unicode:
+ prio = '<%d>' % self.encodePriority(self.facility,
+ self.mapPriority(record.levelname))
+ # Message is a string. Convert to bytes as required by RFC 5424
+ if type(msg) is unicode:
msg = msg.encode('utf-8')
if codecs:
msg = codecs.BOM_UTF8 + msg
+ msg = prio + msg
try:
if self.unixsocket:
try: