1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
.\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH SYSLOG 3 "15 Feb 1994" "Linux" "Linux Programmer's Manual"
.SH NAME
closelog, openlog, syslog \- send messages to the system logger
.SH SYNOPSIS
.B #include <syslog.h>
.sp
.BI "void openlog( char " *ident ", int " option ", int " facility )
.sp
.BI "void syslog( int " priority ", char " *format ", ...)"
.sp
.BI "void closelog( void )"
.sp
.SH DESCRIPTION
.B closelog()
closes the descriptor being used to write to the system logger. The use of
.B closelog()
is optional.
.sp
.B openlog()
opens a connection to the system logger for a program. The string pointed
to by
.I ident
is added to each message, and is typically set to the program name. Values for
.I option
and
.I facility
are given in the next section. The use of
.B openlog()
is optional; It will automatically be called by
.B syslog()
if necessary, in which case
.I ident
will default to NULL.
.sp
.B syslog()
generates a log message, which will be distributed by
.BR syslogd (8).
.I priority
is a combination of the
.I facility
and the
.IR level ,
values for which are given in the next section. The remaining arguments
are a
.IR format ,
as in
.BR printf (3)
and any arguments required by the
.IR format ,
except that the two character %m will be replaced by the error message
string
.RI ( strerror )
corresponding to the present value of
.IR errno .
.SH "PARAMETERS"
This section lists the parameters used to set the values of
.IR option , " facility" ", and " priority .
.SS option
The
.I option
argument to
.B openlog()
is an OR of any of these:
.TP
.B LOG_CONS
write directly to system console if there is an error while sending to
system logger
.TP
.B LOG_NDELAY
open the connection immediately (normally, the connection is opened when
the first message is logged)
.TP
.B LOG_PERROR
print to stderr as well
.TP
.B LOG_PID
include PID with each message
.SS facility
The
.I facility
argument is used to specify what type of program is logging the message.
This lets the configuration file specify that messages from different
facilities will be handled differently.
.TP
.B LOG_AUTH
security/authorization messages (DEPRECATED Use
.B LOG_AUTHPRIV
instead)
.TP
.B LOG_AUTHPRIV
security/authorization messages (private)
.TP
.B LOG_CRON
clock daemon
.RB ( cron " and " at )
.TP
.B LOG_DAEMON
other system daemons
.TP
.B LOG_KERN
kernel messages
.TP
.BR LOG_LOCAL0 " through " LOG_LOCAL7
reserved for local use
.TP
.B LOG_LPR
line printer subsystem
.TP
.B LOG_MAIL
mail subsystem
.TP
.B LOG_NEWS
USENET news subsystem
.TP
.B LOG_SYSLOG
messages generated internally by
.B syslogd
.TP
.BR LOG_USER (default)
generic user-level messages
.TP
.B LOG_UUCP
UUCP subsystem
.SS level
This determines the importance of the message. The levels are, in order
of decreasing importance:
.TP
.B LOG_EMERG
system is unusable
.TP
.B LOG_ALERT
action must be taken immediately
.TP
.B LOG_CRIT
critical conditions
.TP
.B LOG_ERR
error conditions
.TP
.B LOG_WARNING
warning conditions
.TP
.B LOG_NOTICE
normal, but significant, condition
.TP
.B LOG_INFO
informational message
.TP
.B LOG_DEBUG
debug-level message
.SH HISTORY
A
.B syslog
function call appeared in BSD 4.2.
.SH SEE ALSO
.BR logger "(1), " syslog.conf "(5), " syslogd (8)
|