0
votes

In a component test, I make a C binary and test it thanks to pytest.

In the C binary I use syslog.h in order to log what happens.

Howewer there is no syslog file in /var/log/ in container, and no information in syslog on host

I have tried to run rsyslog as a service in the container and several rsyslog.conf configuration. Also I have edited the docker deamon.json to use the syslog service

@pytest.fixture(scope="session")
def generator():    
    process = subprocess.Popen(["./build/bin/myBinqry","-v"])
    yield process
    process.terminate()

/* myBinary */
int main(int argc, char **argv)
{
    openlog("myBinary", logoptions, LOG_DAEMON);
    syslog(LOG_NOTICE, "Service is starting...");   
}

I expected syslog entries either on host or on container /var/log but there is nothing

1

1 Answers

0
votes

The problem was : the service rsyslog was not launched

root@xxx:/var/log# service rsyslog restart
[ ok ] Stopping enhanced syslogd: rsyslogd already stopped.
[ ok ] Starting enhanced syslogd: rsyslogd.