[Python-ideas] SysLogHandler: gratuitous data loss

Jacek Masiulaniec jacek.masiulaniec at gmail.com
Fri Jun 8 15:21:59 CEST 2012


Hello,

In logging.handlers, SysLogHandler defaults to localhost:514.

  http://docs.python.org/py3k/library/logging.handlers.html#logging.handlers.SysLogHandler
  http://docs.python.org/library/logging.handlers.html#logging.handlers.SysLogHandler

In practice, there are systems out there that offer local syslog
service via additional endpoints, for example:

  /dev/log
  /var/run/syslog

Some systems even ship with UDP endpoint disabled by default, in
which case Python's default is to drop data despite the availability
of these other endpoints.

The /dev/log path in particular is so commonplace that many
system-level utils default to it.  Other languages' syslog libraries
provide support for it, too. [1] [2]

I propose a change to SysLogHandler's default behavior:
1) Try connect(2) against the socket files.
2) Use localhost:514 as a fallback.

I believe it's possible to change this interface while remaining
backwards-compatible.

Thoughts?

Jacek

[1] http://hackage.haskell.org/packages/archive/hslogger/1.0.7/doc/html/src/System-Log-Handler-Syslog.html#openlog
[2] http://golang.org/src/pkg/log/syslog/syslog_unix.go



More information about the Python-ideas mailing list