Open ceving opened 2 years ago
This happens because in modern-syslog log()
is async (it's right there in the description but doesn't specify that the other methods are still sync).
In your snippet close()
runs earlier than log()
.
If you want to filter your logs into different directions you could use LOCAL0 to LOCAL7 instead of open/close spam:
syslog.open("myident", syslog.LOG_PID | syslog.LOG_ODELAY, 0);
syslog.log (syslog.LOG_INFO | syslog.LOG_LOCAL0, "test myfacility " + Date.now());
syslog.log (syslog.LOG_INFO | syslog.LOG_LOCAL1, "test myfacility " + Date.now());
I have the following test program.
When I run it, I get the following line in my Syslog:
I was expecting the string "myident" instead of "node".
When I do the same from the Bash,
it works fine: