python logging to syslog linux

Solutions on MaxInterview for python logging to syslog linux by the best coders in the world

showing results for - "python logging to syslog linux"
Mathilda
06 Jan 2019
1import logging
2import logging.handlers
3
4my_logger = logging.getLogger('MyLogger')
5my_logger.setLevel(logging.DEBUG)
6
7handler = logging.handlers.SysLogHandler(address = '/dev/log')
8
9my_logger.addHandler(handler)
10
11my_logger.debug('this is debug')
12my_logger.critical('this is critical')