Opened 8 years ago

Last modified 4 years ago

#37990 assigned defect

python27 @2.7.3_1 SysLogHandler uses wrong default address for syslog

Reported by: robertread@… Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc:
Port: python27

Description

The logging.handlers.SysLogHandler() does not work on Mountain Lion (and probably Lion, but don't have it) by default. This is because the the Apple System Logger listens on UNIX dgram socket /var/run/syslog instead of the standard UDP port. The default address for the system python version of logging.handlers.SysLogHandler is '/var/run/syslog'.

Change History (5)

comment:1 Changed 8 years ago by larryv (Lawrence Velázquez)

Owner: changed from macports-tickets@… to jwa@…

Thanks for the ticket. In the future, please try to Cc relevant port maintainers.

comment:2 Changed 8 years ago by robertread@…

OK, will do. Thanks!

comment:3 Changed 8 years ago by jmroot (Joshua Root)

Is this still a problem with 2.7.5?

comment:4 Changed 8 years ago by robertread@…

Yes, it still appears to be an issue in 2.7.5 - the default address for SysLogHandler is still set to a UDP port instead the /var/run/syslog unix socket. Here is a reproducer. WIth this snippet, I only see the message in /var/log/system.log if I uncomment the address parameter:

import logging
import logging.handlers

logger = logging.getLogger()
syslog = logging.handlers.SysLogHandler(
#                address='/var/run/syslog'
          )
formatter = logging.Formatter('%(name)s[%(process)d]: %(message)s')
syslog.setFormatter(formatter)
logger.addHandler(syslog)
logger.warn("test message!")

comment:5 Changed 4 years ago by jmroot (Joshua Root)

Owner: changed from jyrkiwahlstedt to jmroot
Status: newassigned
Note: See TracTickets for help on using tickets.