4.3BSD-Reno/share/man/cat3/closelog.0
SYSLOG(3) 1990 SYSLOG(3)
NNAAMMEE
syslog, openlog, closelog, setlogmask, vsyslog - control
system log
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyysslloogg..hh>>
ooppeennlloogg((iiddeenntt,, llooggoopptt,, ffaacciilliittyy))
cchhaarr **iiddeenntt;;
ssyysslloogg((pprriioorriittyy,, mmeessssaaggee,, ppaarraammeetteerrss ...... ))
iinntt pprriioorriittyy;;
cchhaarr **mmeessssaaggee;;
##iinncclluuddee <<vvaarraarrggss..hh>>
vvssyysslloogg((pprriioorriittyy,, mmeessssaaggee,, aarrggss))
iinntt pprriioorriittyy;;
cchhaarr **mmeessssaaggee;;
vvaa__lliisstt aarrggss;;
cclloosseelloogg(())
sseettllooggmmaasskk((mmaasskkpprrii))
DDEESSCCRRIIPPTTIIOONN
_S_y_s_l_o_g arranges to write _m_e_s_s_a_g_e onto the system log main-
tained by _s_y_s_l_o_g_d(8). The message is tagged with _p_r_i_o_r_i_t_y.
The message looks like a _p_r_i_n_t_f(3) string except that %%mm is
replaced by the current error message (as referenced by
_e_r_r_n_o). A trailing newline is added if needed. An alter-
nate form, in which the arguments have already been captured
using the variable-length argument facilities of _v_a_r_a_r_g_s(3),
is available under the name _v_s_y_s_l_o_g.
This message will be read by _s_y_s_l_o_g_d(8) and written to the
system console, log files, or forwarded to _s_y_s_l_o_g_d on
another host as appropriate.
Priorities are encoded as a _f_a_c_i_l_i_t_y and a _l_e_v_e_l. The
facility describes the part of the system generating the
message. The level is selected from an ordered list:
LOG_ALERT
A condition that should be corrected immediately, such
as a corrupted system database.
LOG_CRIT
Critical conditions, e.g., hard device errors.
LOG_DEBUG
Messages that contain information normally of use only
when debugging a program.
Printed 7/27/90 June 1
SYSLOG(3) 1990 SYSLOG(3)
LOG_EMERG
A panic condition. This is normally broadcast to all
users.
LOG_ERR
Errors.
LOG_INFO
Informational messages.
LOG_NOTICE
Conditions that are not error conditions, but should
possibly be handled specially.
LOG_WARNING
Warning messages.
If _s_y_s_l_o_g cannot pass the message to _s_y_s_l_o_g_d, it will
attempt to write the message to the console
(``/dev/console'') if the LOG_CONS option is set (see
below).
If special processing is needed, _o_p_e_n_l_o_g can be called to
initialize the log file. The parameter _i_d_e_n_t is a string
that is prepended to every message. _L_o_g_o_p_t is a bit field
indicating logging options. Current values for _l_o_g_o_p_t are:
LOG_CONS
If unable to send the message to _s_y_s_l_o_g_d, write it to
the console.
LOG_NDELAY
Open the connection to _s_y_s_l_o_g_d immediately. Normally
the open is delayed until the first message is logged.
Useful for programs that need to manage the order in
which file descriptors are allocated.
LOG_PERROR
Write the message to stderr as well to the system log.
LOG_PID
Log the process id with each message: useful for iden-
tifying instantiations of daemons.
The _f_a_c_i_l_i_t_y parameter encodes a default facility to be
assigned to all messages that do not have an explicit facil-
ity encoded:
LOG_AUTH
The authorization system: _l_o_g_i_n(1), _s_u(1), _g_e_t_t_y(8),
etc.
Printed 7/27/90 June 2
SYSLOG(3) 1990 SYSLOG(3)
LOG_CRON
The clock daemon.
LOG_DAEMON
System daemons, such as _f_t_p_d(8), _r_o_u_t_e_d(8), etc, that
are not provided for explicitly by other facilities.
LOG_KERN
Messages generated by the kernel. These cannot be gen-
erated by any user processes.
LOG_LPR
The line printer spooling system: _l_p_r(1), _l_p_c(8),
_l_p_d(8), etc.
LOG_MAIL
The mail system.
LOG_NEWS
The network news system.
LOG_SYSLOG
Messages generated internally by _s_y_s_l_o_g_d(8).
LOG_USER
Messages generated by random user processes. This is
the default facility identifier if none is specified.
LOG_UUCP
The uucp system.
LOG_LOCAL0
Reserved for local use. Similarly for LOG_LOCAL1
through LOG_LOCAL7.
_C_l_o_s_e_l_o_g can be used to close the log file.
_S_e_t_l_o_g_m_a_s_k sets the log priority mask to _m_a_s_k_p_r_i and returns
the previous mask. Calls to _s_y_s_l_o_g with a priority not set
in _m_a_s_k_p_r_i are rejected. The mask for an individual prior-
ity _p_r_i is calculated by the macro LOG_MASK(_p_r_i); the mask
for all priorities up to and including _t_o_p_p_r_i is given by
the macro LOG_UPTO(_t_o_p_p_r_i). The default allows all priori-
ties to be logged.
EEXXAAMMPPLLEESS
syslog(LOG_ALERT, "who: internal error 23");
openlog("ftpd", LOG_PID, LOG_DAEMON);
setlogmask(LOG_UPTO(LOG_ERR));
syslog(LOG_INFO, "Connection from host %d", CallingHost);
Printed 7/27/90 June 3
SYSLOG(3) 1990 SYSLOG(3)
syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
SSEEEE AALLSSOO
logger(1), syslogd(8)
Printed 7/27/90 June 4