diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 24a2f6ca..a3d54e70 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -363,8 +363,15 @@ class Logger(object): socktype, addr = parse_syslog_address(cfg.syslog_addr) # finally setup the syslog handler - h = logging.handlers.SysLogHandler(address=addr, facility=facility, - socktype=socktype) + if sys.version_info >= (2, 7): + h = logging.handlers.SysLogHandler(address=addr, + facility=facility, socktype=socktype) + else: + # socktype is only supported in 2.7 and sup + # fix issue #541 + h = logging.handlers.SysLogHandler(address=addr, + facility=facility) + h.setFormatter(fmt) h._gunicorn = True log.addHandler(h)