fix install
[unix-history] / usr / src / usr.sbin / sendmail / doc / syslog.3
CommitLineData
3bfbd4c4
EA
1.TH SYSLOG 3
2.\" @(#)syslog.3 1.2 %G%
0e937508
EA
3.SH NAME
4syslog, openlog, closelog -- control system log
5.SH SYNOPSIS
6# include <syslog.h>
3bfbd4c4 7.PP
0e937508
EA
8openlog(ident, logstat)
9.br
10char *ident;
3bfbd4c4 11.PP
0e937508
EA
12syslog(priority, message, parameters ... )
13.br
14char *message;
3bfbd4c4 15.PP
0e937508
EA
16closelog()
17.SH DESCRIPTION
18.I Syslog
3bfbd4c4
EA
19arranges to
20write the
0e937508 21.I message
3bfbd4c4
EA
22onto the
23system log maintained by
24.IR syslog (8).
25The message is tagged with
0e937508
EA
26.I priority.
27The message looks like a
28.I printf(3)
29string except that
30.B %m
31is replaced by the current error message
32(collected from
33.I errno\c
34).
35A trailing newline is added if needed.
36This message will be read by
37.I syslog(8)
38and output to the system console or files as appropriate.
39.PP
40If special processing is needed,
41.I openlog
42can be called to initialize the log file.
43Parameters are
44.I ident
45which is prepended to every message,
46and
47.I logstat
3bfbd4c4 48which is
0e937508
EA
49a bit field indicating special status;
50current values are:
51.IP LOG_PID \w'LOG_PID'u+3
52log the process id with each message:
53useful for identifying instantiations of daemons.
54.LP
55.I Openlog
56returns zero on success.
57If it cannot open the file
58.I /dev/log,
59it writes on
60.I /dev/console
61instead and returns -1.
62.PP
63.I Closelog
64can be used to close the log file.
65.SH EXAMPLES
66.nf
67syslog(LOG_SALERT, "who: internal error 23");
68
69openlog("serverftp", LOG_PID);
70syslog(LOG_INFO, "Connection from host %d", CallingHost);
71.fi
72.SH SEE\ ALSO
73syslog(8)