Solved python SysLogHandler no working?

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?

Code:
# 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!')

I'm using the following commands to test:
Code:
tail -F /var/log/messages &
python mylog.py

I tested this on FreeBSD 11 and 10.3. And on Fedora 25.
 
Yes, by default /var/log/messages only logs notices and higher.
Code:
*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err   /var/log/messages
For testing you may want to enable this:
Code:
# uncomment this to enable logging of all log messages to /var/log/all.log
# touch /var/log/all.log and chmod it to mode 600 before it will work
#*.*                                            /var/log/all.log
 
Back
Top