summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-10-21 20:22:14 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-10-21 20:22:14 (GMT)
commit42ead48dc17543c0d41d261fdf070a07f576c449 (patch)
tree960a58e16b341fb10de9787551a1636ed913e4ce /Lib/logging
parentff8c1e5aceb7737d424610dd1adeed773b84b8db (diff)
downloadcpython-42ead48dc17543c0d41d261fdf070a07f576c449.zip
cpython-42ead48dc17543c0d41d261fdf070a07f576c449.tar.gz
cpython-42ead48dc17543c0d41d261fdf070a07f576c449.tar.bz2
Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 2d71470..2437c34 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -779,6 +779,10 @@ class SysLogHandler(logging.Handler):
self.encodePriority(self.facility,
self.mapPriority(record.levelname)),
msg)
+ #Message is a string. Convert to bytes as required by RFC 5424
+ msg = msg.encode('utf-8')
+ if codecs:
+ msg = codecs.BOM_UTF8 + msg
try:
if self.unixsocket:
try: