ok this code will reproduce. Note that key was to convert to utf8 before sending to syslog.
# vim: tabstop=4 shiftwidth=4 softtabstop=4 import logging from logging.handlers import SysLogHandler
# our new audit level # NOTE(jkoelker) Since we synthesized an audit level, make the logging # module aware of it so it acts like other levels. logging.AUDIT = logging.INFO + 1 logging.addLevelName(logging.AUDIT, 'AUDIT')
logger = logging.getLogger() logger.setLevel(logging.INFO) facility = getattr(logging.handlers.SysLogHandler, 'LOG_SYSLOG', None)
syslog = logging.handlers.SysLogHandler(address='/dev/log', facility=facility)
formatter = logging.Formatter('%(name)s: %(levelname)s: %(message)s') syslog.setFormatter(formatter) logger.addHandler(syslog) # 'application' code msg = unicode("TEST LOGER FROM PYTHON", "utf-8") logger.log(logging.AUDIT, msg)
ok this code will reproduce. Note that key was to convert to utf8 before sending to syslog.
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import logging
from logging.handlers import SysLogHandler
# our new audit level addLevelName( logging. AUDIT, 'AUDIT')
# NOTE(jkoelker) Since we synthesized an audit level, make the logging
# module aware of it so it acts like other levels.
logging.AUDIT = logging.INFO + 1
logging.
logger = logging.getLogger() setLevel( logging. INFO) logging. handlers. SysLogHandler, 'LOG_SYSLOG', None)
logger.
facility = getattr(
syslog = logging. handlers. SysLogHandler( address= '/dev/log' , facility=facility)
formatter = logging. Formatter( '%(name) s: %(levelname)s: %(message)s') setFormatter( formatter) addHandler( syslog) log(logging. AUDIT, msg)
syslog.
logger.
# 'application' code
msg = unicode("TEST LOGER FROM PYTHON", "utf-8")
logger.