Hi, I'm trying to use syslog handler at one of my python scripts. Above there is a script that should print hello world to syslog, but it doesn't. The same code on Linux works. What I'm missing?
I'm using the following commands to test:
I tested this on FreeBSD 11 and 10.3. And on Fedora 25.
# mylog.py from platform import system import logging from logging.handlers import SysLogHandler if system() == 'Linux': logusock = '/dev/log' elif system() == 'FreeBSD': logusock = '/var/run/log' l = logging.getLogger() l.setLevel(logging.INFO) syslog = SysLogHandler(logusock) l.addHandler(syslog) l.info('Hello syslog!')
tail -F /var/log/messages & python mylog.py