除了已接受的答案外,了解以下内容也很有用...
每个函数都应该与手册页面相关联。
如果你运行 man -k syslog
(对手册页进行关键字搜索),你将得到一个包含有关syslog的手册页的列表。
$ man -k syslog
logger (1) - a shell command interface to the syslog(3) system l...
rsyslog.conf (5) - rsyslogd(8) configuration file
rsyslogd (8) - reliable and extended syslogd
syslog (2) - read and/or clear kernel message ring buffer; set c...
syslog (3) - send messages to the system logger
vsyslog (3) - send messages to the system logger
为了深入探讨,您需要理解手册的各节。
这是man页的一个摘录,解释了man页的各节:
The table below shows the section numbers of the manual followed by
the types of pages they contain.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
阅读上述内容请运行:
$man man
如果你运行man 3 syslog
,你会得到一个完整的手册页面,介绍了你在代码中调用的syslog
函数。
SYSLOG(3) Linux Programmer's Manual SYSLOG(3)
NAME
closelog, openlog, syslog, vsyslog - send messages to the system
logger
SYNOPSIS
#include <syslog.h>
void openlog(const char *ident, int option, int facility);
void syslog(int priority, const char *format, ...);
void closelog(void);
#include <stdarg.h>
void vsyslog(int priority, const char *format, va_list ap);
虽然不是直接回答,但希望这对你有所帮助。
/etc/
某个位置有一个配置文件,您需要更改其中的标识符(在您的情况下为“test”)和设施。 - Some programmer dudesetlogmask()
或openlog()
,所有syslog()消息都会出现在控制台/stdout
上。 - Charlie Reitzel