1 .\" Copyright (c) 1997 Kungliga Tekniska Högskolan
2 .\" $Id: krb5_openlog.3,v 1.4 1999/04/07 14:06:32 joda Exp $
10 .Nm krb5_addlog_dest ,
11 .Nm krb5_addlog_func ,
16 .Nd Heimdal logging functions
21 .ds xx \\*(fP\fR(\fP\\*(lI*\\*(fP
23 .Fn "\\*(lItypedef void \\*(xxkrb5_log_log_func_t\\*(xy" "const char *time" "const char *message" "void *data"
24 .Fn "\\*(lItypedef void \\*(xxkrb5_log_close_func_t\\*(xy" "void *data"
27 .Fn krb5_addlog_dest "krb5_context context" "krb5_log_facility *facility" "const char *destination"
30 .Fn krb5_addlog_func "krb5_context context" "krb5_log_facility *facility" "int min" "int max" "krb5_log_log_func_t log" "krb5_log_close_func_t close" "void *data"
33 .Fn krb5_closelog "krb5_context context" "krb5_log_facility *facility"
36 .Fn krb5_initlog "krb5_context context" "const char *program" "krb5_log_facility **facility"
39 .Fn krb5_log "krb5_context context" "krb5_log_facility *facility" "int level" "const char *format" "..."
42 .Fn krb5_log_msg "krb5_context context" "krb5_log_facility *facility" "char **reply" "int level" "const char *format" "..."
45 .Fn krb5_openlog "krb5_context context" "const char *program" "krb5_log_facility **facility"
48 .Fn krb5_vlog "krb5_context context" "krb5_log_facility *facility" "int level" "const char *format" "va_list arglist"
51 .Fn krb5_vlog_msg "krb5_context context" "krb5_log_facility *facility" "char **reply" "int level" "const char *format" "va_list arglist"
54 These functions logs messages to one or more destinations.
58 function creates a logging
60 that is used to log messages. A facility consists of one or more
61 destinations (which can be files or syslog or some other device). The
63 parameter should be the generic name of the program that is doing the
64 logging. This name is used to lookup which destinations to use. This
65 information is contained in the
69 configuration file. If no entry is found for
73 is used, or if that is missing too,
75 will be used as destination.
77 To close a logging facility, use the
81 To log a message to a facility use one of the functions
87 The functions ending in
91 a pointer to the message that just got logged. This string is allocated,
92 and should be freed with
98 style format string (but see the BUGS section).
101 If you want better control of where things gets logged, you can instead of using
105 which just initializes a facility, but doesn't define any actual logging
106 destinations. You can then add destinations with the
110 functions. The first of these takes a string specifying a logging
111 destination, and adds this to the facility. If you want to do some
112 non-standard logging you can use the
114 function, which takes a function to use when logging.
117 function is called for each message with
119 being a string specifying the current time, and
123 is called when the facility is closed. You can pass application specific data in the
129 parameter are the same as in a destination (defined below). To specify a
130 max of infinity, pass -1.
137 for each destination found.
141 The defined destinations (as specified in
144 .Bl -tag -width "xxx" -offset indent
146 This logs to the program's stderr.
147 .It Li FILE: Ns Pa /file
148 .It Li FILE= Ns Pa /file
149 Log to the specified file. The form using a colon appends to the file, the
150 form with an equal truncates the file. The truncating form keeps the file
151 open, while the appending form closes it after each log message (which
152 makes it possible to rotate logs). The truncating form is mainly for
153 compatibility with the MIT libkrb5.
154 .It Li DEVICE= Ns Pa /device
155 This logs to the specified device, at present this is the same as
158 Log to the console, this is the same as
159 .Li DEVICE=/dev/console .
160 .It Li SYSLOG Ns Op :priority Ns Op :facility
161 Send messages to the syslog system, using priority, and facility. To
162 get the name for one of these, you take the name of the macro passed
165 and remove the leading
170 The default values (as well as the values used for unrecognised
177 for a list of priorities and facilities.
180 Each destination may optionally be prepended with a range of logging
187 is within this range (inclusive) the message gets logged to this
188 destination, otherwise not. Either of the min and max valued may be
189 omitted, in this case min is assumed to be zero, and max is assumed to be
190 infinity. If you don't include a dash, both min and max gets set to the
191 specified value. If no range is specified, all messages gets logged.
193 .Bd -literal -offset indent
195 kdc = 0/FILE:/var/log/kdc.log
196 kdc = 1-/SYSLOG:INFO:USER
200 This will log all messages from the
202 program with level 0 to
203 .Pa /var/log/kdc.log ,
204 other messages will be logged to syslog with priority
208 All other programs will log all messages to their stderr.
212 to format the message. If your operating system does not have a working
214 a replacement will be used. At present this replacement does not handle
215 some correct conversion specifications (like floating point numbers). Until
216 this is fixed, the use of these conversions should be avoided.
218 If logging is done to the syslog facility, these functions might not be
219 thread-safe, depending on the implementation of