Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

syslog.syslog vs SysLogHandler

Tags:

I'm looking at how to log to syslog from within my Python app, and I found there are two ways of doing it:

  1. Using syslog.syslog() routines
  2. Using the logger module SysLogHandler

Which is the best option to use, advantages/disadvantages of each one, etc, because I really don't know which one should I use.

like image 701
Juancho Avatar asked Dec 27 '12 05:12

Juancho


People also ask

What is syslog in Python?

syslog(message) or syslog. syslog(priority, message) This method is used to send a string type message to the system logger. Each message has a priority. The priority argument can be used to set the priority of the given message.

What is a syslog device?

System Logging Protocol (Syslog) is a way network devices can use a standard message format to communicate with a logging server. It was designed specifically to make it easy to monitor network devices. Devices can use a Syslog agent to send out notification messages under a wide range of specific conditions.


1 Answers

syslog.syslog() can only be used to send messages to the local syslogd. SysLogHandler can be used as part of a comprehensive, configurable logging subsystem, and can log to remote machines.

like image 193
Ignacio Vazquez-Abrams Avatar answered Sep 28 '22 05:09

Ignacio Vazquez-Abrams