📜  python 日志记录到 syslog linux - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:43.682000             🧑  作者: Mango

代码示例1
import logging
import logging.handlers

my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)

handler = logging.handlers.SysLogHandler(address = '/dev/log')

my_logger.addHandler(handler)

my_logger.debug('this is debug')
my_logger.critical('this is critical')