Skip to content
Snippets Groups Projects
Commit a69f0cb7 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Logging module in Python 2.6 does not accept unicode socket path - but strings...

Logging module in Python 2.6 does not accept unicode socket path - but strings from JSON configuration are always unicode. Applied workaround, now on 2.6 Client accepts at least ASCII filenames for syslog socket.
parent 130ec9c6
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,9 @@ from sys import stderr, exc_info ...@@ -11,6 +11,9 @@ from sys import stderr, exc_info
from traceback import format_tb from traceback import format_tb
from os import path from os import path
from operator import itemgetter from operator import itemgetter
from sys import version_info
fix_logging_filename = str if version_info<(2.7) else lambda(x): x
VERSION = "3.0-beta2" VERSION = "3.0-beta2"
...@@ -292,7 +295,7 @@ class Client(object): ...@@ -292,7 +295,7 @@ class Client(object):
if syslog is not None: if syslog is not None:
try: try:
sl = logging.handlers.SysLogHandler( sl = logging.handlers.SysLogHandler(
address=syslog.get("socket", "/dev/log"), address=fix_logging_filename(syslog.get("socket", "/dev/log")),
facility=facility(syslog.get("facility", "local7"))) facility=facility(syslog.get("facility", "local7")))
sl.setLevel(loglevel(syslog.get("level", "debug"))) sl.setLevel(loglevel(syslog.get("level", "debug")))
sl.setFormatter(format_notime) sl.setFormatter(format_notime)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment