Opened 12 years ago
Closed 2 years ago
#37990 closed defect (wontfix)
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 (6)
comment:1 Changed 12 years ago by larryv (Lawrence Velázquez)
Owner: | changed from macports-tickets@… to jwa@… |
---|
comment:4 Changed 11 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 7 years ago by jmroot (Joshua Root)
Owner: | changed from jyrkiwahlstedt to jmroot |
---|---|
Status: | new → assigned |
comment:6 Changed 2 years ago by jmroot (Joshua Root)
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
This isn't going to change in Python 2.7 at this point. Changing the default syslog address for macOS in current versions would be something to request upstream.
Thanks for the ticket. In the future, please try to Cc relevant port maintainers.