3

I have started to use logging module in python. My python code properly logs via several handlers but in my code I still use also syslog module. When I tried to replace it and add just another handler to logging, I found out that output differs.

logging.handlers.SysLogHandler(address = "/dev/log")
...
logging.error("Foo")

syslog.syslog(syslog.LOG_ERR, "Foo")

The output is:

Apr 14 16:42:33 hroch journal: Foo

Apr  2 10:11:51 hroch myscript: Unable to connect/login to fencing device

Attempt to use logging.Formatter did not bring any success as only part after colon is changed.

1 Answer 1

1

The address= parameter to SysLogHandler() should be a (host, port) tuple. Try leaving it off; the default is ('localhost', SYSLOG_UDP_PORT), which might be what you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.