Created
May 12, 2014 02:39
-
-
Save makotoshimazu/5a91ddc5e0ced72fff2e to your computer and use it in GitHub Desktop.
syslog関数を利用してsyslogにログを吐いてみるテスト。 userのfacilityのログが出るように、(ubuntu14.04では)/etc/rsyslog.d/50-default.confを編集する必要がある。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <syslog.h> | |
int main(void) | |
{ | |
printf("Hello World!\n"); | |
openlog("testmsg", LOG_CONS|LOG_PID, LOG_USER); | |
syslog(LOG_WARNING, "Hello World!\n"); | |
closelog(); | |
printf("syslog is closed\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment