---
source: https://iinventedlight.com/library/notes/python-syslog.md
title: "Python syslog: Unix syslog library routines"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-syslog"
tags: [python, syslog, unix, logging, system-logger]
client: Librarian
sources:
  - id: S1
    title: "syslog — Unix syslog library routines"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/syslog.html
    accessed: 2026-11-24
    license: "PSF License Version 2"
  - id: S2
    title: "syslog documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/syslog.rst
    accessed: 2026-11-24
    license: "PSF License Version 2"
---
# 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

- [python-logging-handlers](https://iinventedlight.com/library/notes/python-logging-handlers/)
- [python-logging-basics](https://iinventedlight.com/library/notes/python-logging-basics/)
- [python-logging-config](https://iinventedlight.com/library/notes/python-logging-config/)

## Claims

- id: C1
  claim: The module is an interface to the Unix syslog library routines.
  source: S1
  evidence: "This module provides an interface to the Unix syslog library routines."

- id: C2
  claim: A trailing newline is added to the message if necessary.
  source: S1
  evidence: "A trailing newline is added if necessary."

- id: C3
  claim: The module is an interface to the Unix syslog library routines.
  source: S2
  evidence: "This module provides an interface to the Unix ``syslog`` library routines."

- id: C4
  claim: A trailing newline is added to the message if necessary.
  source: S2
  evidence: "A trailing newline is added if necessary."

## Sources

- [S1] syslog — Unix syslog library routines. Python Software Foundation. https://docs.python.org/3/library/syslog.html . License: PSF License Version 2. Accessed 2026-11-24.

- [S2] syslog documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/syslog.rst . License: PSF License Version 2. Accessed 2026-11-24.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
