Skip to content

Instantly share code, notes, and snippets.

@romuald
Created August 24, 2011 13:26
Show Gist options
  • Save romuald/1168049 to your computer and use it in GitHub Desktop.
Save romuald/1168049 to your computer and use it in GitHub Desktop.
syslog handler fix for python
from logging.handlers import SysLogHandler as Base
class SysLogHandler(Base):
def emit(self, record):
if type(record.msg) is unicode:
# RFC says we should prefix with BOM, but rsyslog will log the BOM
record.msg = record.msg.encode('utf-8')
return Base.emit(self, record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment