new doc makefiles
[unix-history] / usr / src / usr.sbin / sendmail / doc / syslog.3
... / ...
CommitLineData
1.TH SYSLOG 3
2.\" @(#)syslog.3 4.1 %G%
3.SH NAME
4syslog, openlog, closelog -- control system log
5.SH SYNOPSIS
6# include <syslog.h>
7.PP
8openlog(ident, logstat)
9.br
10char *ident;
11.PP
12syslog(priority, message, parameters ... )
13.br
14char *message;
15.PP
16closelog()
17.SH DESCRIPTION
18.I Syslog
19arranges to
20write the
21.I message
22onto the
23system log maintained by
24.IR syslog (8).
25The message is tagged with
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
48which is
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)