WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Can syslog from C, not from python  (Read 1599 times)

Offline eggi

  • Newbie
  • *
  • Posts: 1
Can syslog from C, not from python
« on: December 28, 2011, 08:34:20 AM »
I am trying to get a couple of programs to log to the syslog on a MicroCore x64 machine, one written in python and one in Java, but neither one does.  However, if I create a C program that does the same it works just fine.  Does anyone have any idea what is going on?  Are both the Python logging module and Log4J misconfigured or am I doing something stupid?

It does not matter whether I start syslogd from the boot script or manually with "sudo syslogd -n".  Looking at the syslog, there are entries from the kernel, sshd and sudo. 

The python script (which works just fine on my Mac BTW) looks like this:

Code: (python) [Select]
#!/usr/bin/env python

import logging
from logging.handlers import SysLogHandler
log = logging.getLogger(__name__)
logging.getLogger().addHandler(SysLogHandler())
log.error("I'm logging this")

.. and the C program that works looks like this:

Code: (c) [Select]
#include <syslog.h>

void main() {
syslog(LOG_ERR, "I'm logging this");
}