Consider adding logging.handlers.LocalSysLogHandler

Offen
#96,339 9 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
tooling

Rechercherichtung

Beginne mit dem Logging-Paket und der vorgeschlagenen Verwendung von syslog.syslog und prüfe anschließend den verknüpften PR gh-154548. Kläre die Fragen zur globalen Konfiguration und zur Prioritätszuordnung und definiere das Verhalten von LocalSysLogHandler, damit die lokale macOS-Systemprotokollierung ohne Unklarheiten funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

stdlib type-feature

Feature or enhancement

Add a handler to the logging package that uses syslog.syslog to log

Pitch

As mentioned in #91070 the logging.handlers.SysLogHandler cannot log to the local system log on recent versions of macOS. It is possible to log using syslog.syslog, I've checked that the code below results in a message in the system log:

syslog.syslog(syslog.LOG_WARNING|syslog.LOG_LOCAL7, "message from python")

Because of this it might be useful to define a LocalSysLogHander class that logs locally using the syslog module.

There is a design challenge here though: The syslog module (and libc function) has proces global configuration. This in particular affects the "ident" field which can only be set as proces global configuration. Another challenge is the interaction between the logging package handling of priorities and handling of those in syslog(3).

Linked PRs
  • gh-154548
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
558

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python/cpython

Alle Issues in python/cpython

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.