Home | Mirror | Search |
# cat syslog.c #include <stdio.h> #include <unistd.h> #include <syslog.h> int main(void) { openlog("slog", LOG_PID|LOG_CONS, LOG_USER); syslog(LOG_INFO, "A different kind of Hello world ... "); closelog(); return 0; }
[root@dev1 test]# gcc syslog.c [root@dev1 test]# ls a.out syslog.c [root@dev1 test]# ./a.out [root@dev1 test]# tail /var/log/messages Jan 11 23:52:27 dev1 slog[5056]: A different kind of Hello world ...