|
|
1.1 root 1: .TH syslog 3
2: .SH NAME
3: syslog, openlog, closelog -- control system log
4: .SH SYNOPSIS
5: # include <syslog.h>
6: .PP
7: openlog(ident, logstat)
8: .br
9: char *ident;
10: .PP
11: syslog(priority, message, parameters ... )
12: .br
13: char *message;
14: .PP
15: closelog()
16: .SH DESCRIPTION
17: .I Syslog
18: writes the
19: .I message
20: to the program syslog(8)
21: The message is tagged with priority
22: .I priority.
23: The message looks like a
24: .I printf(3)
25: string except that
26: .B %m
27: is replaced by the current error message
28: (collected from
29: .I errno\c
30: ).
31: A trailing newline is added if needed.
32: This message will be read by
33: .I syslog(8)
34: and output to the system console or files as appropriate.
35: .PP
36: If special processing is needed,
37: .I openlog
38: can be called to initialize the log file.
39: Parameters are
40: .I ident
41: which is a string prepended to every message,
42: and
43: .I logstat
44: a bit field indicating special status;
45: current values are:
46: .IP LOG_PID \w'LOG_PID'u+3
47: log the process id with each message:
48: useful for identifying instantiations of daemons.
49: .LP
50: .I Openlog
51: returns zero if it could create the socket.
52: Otherwise, it arranges to write on /dev/console
53: and returns -1.
54: Calls to
55: .I syslog
56: can still proceed,
57: but any message with priority under
58: .I LogMask (normally
59: .BR LOG_CRIT )
60: will be thrown away.
61: .PP
62: .I Closelog
63: can be used to close the log socket.
64: .SH EXAMPLES
65: .nf
66: syslog(LOG_SALERT, "who: internal error 23");
67: .PP
68: openlog("serverftp", LOG_PID);
69: syslog(LOG_INFO, "Connection from host %d", CallingHost);
70: .fi
71: .SH SEE\ ALSO
72: syslog(8)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.