Linux - System Log
Linux 當事件發生會產生 log,通常會存在 /var/log 底下。優先度如下。- debug
- info
- notice
- warning
- err
- crit
- alert
- emerg/panic
C 實作 - void syslog(int priority, const char *format, ...)
#include<stdio.h>
#include<stdlib.h>
#include<syslog.h>
syslog(LOG_INFO, "hello %s", "woring");
syslog(LOG_ERR, "hello %s", "test");
底下為參數 int priorityLOG_USER | : A miscellaneous user process |
LOG_MAIL | |
LOG_DAEMON | : A miscellaneous system daemon |
LOG_AUTH | : Security (authorization) |
LOG_SYSLOG | : Syslog |
LOG_LPR | : Central printer |
LOG_NEWS | : Network news (e.g. Usenet) |
LOG_UUCP | : UUCP |
LOG_CRON | : Cron and At |
LOG_AUTHPRIV | : Private security (authorization) |
LOG_FTP | : Ftp server |
LOG_LOCAL(0~7) | : Locally defined |
參考資料 :
https://ithelp.ithome.com.tw/articles/10159084
http://yu-minspace.blogspot.com/2007/09/linux-syslogd-openlogsyslogdsyslog.html
0 意見:
張貼留言