Hi,

is there something special about the first word of the log message when I
use the sysloghandler in Python? I get different results depending on if I
sent the same message from the command line with logger or from Python.

Here is my script and config to reproduce this:

[PYTHON SCRIPT]
import logging
from logging.handlers import SysLogHandler
import subprocess
import time

msg = "firstwordofmessage rest of message %s" % (time.time())

log = logging.getLogger()
log.setLevel(logging.DEBUG)
log.addHandler(SysLogHandler("/dev/log", facility=SysLogHandler.LOG_LOCAL0))
log.warning(msg + " from python logger")

cmd = "logger -p local0.warning %s from command line" % (msg)
subprocess.call(cmd.split(" "))

---

[RSYSLOG CONFIG]

$template debugFile,"/tmp/test/%msg%"
local0.* ?debugFile


[contents of /tmp/test after excution]

14:22:57 obestwalter@wroz [0] < /tmp/test >  596 %
ls
 firstwordofmessage rest of message 1396873380.71 from command line
 rest of message 1396873380.71 from python logger

The file names start with a space in both cases but from python the first
word went missing. I went through it with the debugger to see what happens
on the Python side: the message is prepended with <130> in (which is the
numerical prio/facility).

[content of the file from python log]

Apr  7 14:34:43 wroz firstwordofmessage rest of message 1396874083.19 from
python logger

Can someone help me to understand?

Cheers
Oliver
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to