|
|
1.1 root 1: .TH SYSLOG 3 "14 November 1982"
2: .\" @(#)syslog.3 1.2 11/14/82
3: .SH NAME
4: syslog, openlog, closelog \- control system log
5: .SH SYNOPSIS
6: .B "#include <syslog.h>
7: .PP
8: .B "openlog(ident, logstat)
9: .br
10: .B "char *ident;
11: .PP
12: .B "syslog(priority, message, parameters ... )
13: .br
14: .B "char *message;
15: .PP
16: .B "closelog()
17: .SH DESCRIPTION
18: .I Syslog
19: arranges to write the
20: .I message
21: onto the system log maintained by
22: .IR syslog (8).
23: The message is tagged with
24: .IR priority .
25: The message looks like a
26: .IR printf (3)
27: string except that
28: .B %m
29: is replaced by the current error message (collected from
30: .IR errno ).
31: A trailing newline is added if needed.
32: This message will be read by
33: .IR 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 prepended to every message, and
42: .I logstat
43: which is a bit field indicating special status; current values are:
44: .IP LOG_PID \w'LOG_PID'u+3
45: log the process id with each message:
46: useful for identifying instantiations of daemons.
47: .LP
48: .I Openlog
49: returns zero on success.
50: If it cannot open the file
51: .I /dev/log,
52: it writes on
53: .I /dev/console
54: instead and returns \-1.
55: .PP
56: .I Closelog
57: can be used to close the log file.
58: .SH EXAMPLES
59: .nf
60: syslog(LOG_SALERT, "who: internal error 23");
61:
62: openlog("serverftp", LOG_PID);
63: syslog(LOG_INFO, "Connection from host %d", CallingHost);
64: .fi
65: .SH "SEE ALSO
66: syslog(8)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.