Returns a new instance of the SysLogHandler class intended to communicate with a remote Unix machine whose address is given by address in the form of a (host, port) tuple. If address is not specified, ('localhost', 514) is used. The address is used to open a socket. An alternative to providing a (host, port) tuple is providing an address as a string, for example ‘/dev/log’. In this case, a Unix domain socket is used to send the message to the syslog.
是的,这是可能的,但是我认为您需要使用}发送到正确配置的记录器。
这样的记录器将使用
Popen
而不是check_call
,并将进程stdout
和{logging.handlers.SysLogHandler
向您的syslog服务器发送消息。下面是如何创建这样一个记录器的简短示例:下面是一个如何将
^{pr2}$check_call
替换为Popen
并将数据发送到记录器的示例:我在2017年遇到了这个问题,所以我认为继续为python3更新它可能是个好主意,因为解决方案需要稍作修改。为了能够利用Python 3中的
SysLogHandler
,您必须按如下方式调整代码:如here所述,
SysLogHandler
类相关问题 更多 >
编程相关推荐