捕获SysLogHandler的输出 [英] Catch SysLogHandler's output
问题描述
按照建议,我计划将错误从几个时间关键的python进程(客户端)记录到单个日志记录进程(服务器)。 SysLogHandler 似乎是正确的选择,因为它使用UDP(我宁愿系统不可知的),不等待任何确认,因为我使用 localhost
,所以实际上应该没有日志丢失。
Following advice, I'm planning to log errors from several time critical python processes (clients) to a single logging process (server). SysLogHandler seems to be the correct choice as it uses UDP (I rather be system-agnostic) and does not wait for any confirmation, and as I'm using localhost
so there should practically be no loss of logs.
但是,我不清楚如何在两个帐户上实现服务器端:
However, I'm unclear as to how I should implement the server side on two accounts:
- 只需打开
multiprocessing.connection
和conn.recv()
日志文本? - 是否有一种方法可以将错误作为服务器端的日志处理,从而使用其他
logging.handlers
打印?或者是那时只是纯字符串?
- Should I simply open a
multiprocessing.connection
andconn.recv()
the log as text? - Is there a way to handle the error as a log on the server side, thus printing it using other
logging.handlers
? Or is it just plain strings at that point?
一个很好的用例是时间关键进程发送错误到日志记录过程,它会使用 SMTPHandler 通过电子邮件发送这些错误。 。
A nice use-case would be for the time critical processes to send errors to the logging process which in turn would use SMTPHandler to send these errors via email...
推荐答案
那么,为了继续建议(;),看看 rsyslog ,这是我所知道的最强大的syslog服务器。
它支持线程日志记录工具,大量加载和邮件发送。
Well, to continue with advices ( ;) ), take a look to rsyslog, this is the most powerfull syslog server I know. It support threaded logging facilities, massive load and mail sending.
这篇关于捕获SysLogHandler的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!