简体   繁体   English

Python WSGI和syslog

[英]Python WSGI and syslog

I have a python script that is looging to syslog without an issue. 我有一个python脚本,可以毫无问题地进入syslog。 On the same box I have a python script running via apache and WSGI and I can not get it to log to syslog. 在同一个盒子上,我有一个通过apache和WSGI运行的python脚本,但我无法将其登录到syslog。 The logging configuration is almost identical and here is the section from the WSGI program. 日志记录配置几乎相同,这是WSGI程序的部分。

formatter=logging.Formatter('%(levelname)s:%(message)s')
logger = logging.getLogger('my_log')
logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address='/dev/log',facility=logging.handlers.SysLogHandler.LOG_LOCAL1)
handler.setLevel(logging.DEBUG)
handler.setFormatter(formatter)
logger.addHandler(handler)

logging.log(level,"%s" % (msg)) logging.log(level,“%s”%(msg))

Any idea why it wouldn't work from WSGI or how to get this to work properly? 知道为什么它不能在WSGI中工作还是如何使其正常工作? Thanks. 谢谢。

Does Apache user have access to '/dev/log'? Apache用户可以访问“ / dev / log”吗?

Why not send it through to Apache error log and then configure Apache to send output to syslog? 为什么不将其发送到Apache错误日志,然后将Apache配置为将输出发送到syslog?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM