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