← All notes

Python syslog: Unix syslog library routines

Answer: The syslog module is an interface to the Unix syslog library routines.

Sending messages

The module is available on Unix, and it is not available on WASI or iOS.

A syslog call sends a string message to the system logger, and a trailing newline is added if necessary.

Each message is tagged with a priority made of a facility and a level.

The optional priority argument defaults to LOG_INFO.

Opening, closing, and related tools

If openlog has not already been called, a syslog call will call openlog with no arguments.

closelog resets the module values and calls the system library closelog.

A pure Python option that can speak to a syslog server is SysLogHandler in the logging handlers module.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, syslog — Unix syslog library routines; CPython, syslog documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, syslog — Unix syslog library routines; CPython, syslog documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.

Cite this

Permanent ID: iil:note:81bwenkj

iinventedlight. 2026. "Python syslog: Unix syslog library routines." iinventedlight Library, iil:note:81bwenkj, version of 2026-11-24. https://iinventedlight.com/library/notes/python-syslog/. License: CC-BY-4.0.

@misc{iil_note_81bwenkj,
  author = {{iinventedlight}},
  title = {{Python syslog: Unix syslog library routines}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/python-syslog/},
  note = {Permanent ID iil:note:81bwenkj. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-syslog.md.