Questions tagged «syslog»

11
如何在Python中将日志记录配置为syslog?
我无法理解Python的logging模块。我的需求非常简单:我只想将所有内容记录到syslog中。阅读文档后,我想到了这个简单的测试脚本: import logging import logging.handlers my_logger = logging.getLogger('MyLogger') my_logger.setLevel(logging.DEBUG) handler = logging.handlers.SysLogHandler() my_logger.addHandler(handler) my_logger.debug('this is debug') my_logger.critical('this is critical') 但是此脚本不会在syslog中产生任何日志记录。怎么了?
121 python  logging  syslog 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.