Technical data

log(7D) Devices SunOS 5.5
Each trace_ids structure specifies a mid, sid, and level from which messages will be
accepted. strlog() will accept messages whose mid and sid exactly match those in the
trace_ids structure, and whose level is less than or equal to the level givenin the
trace_ids structure. A value of 1 in any of the fields of the trace_ids structure indicates
that any value is accepted for that field.
Once the logger process has identified itself using the ioctl call, log will beginsending up
messages subject to the restrictions noted above. These messages are obtained using the
getmsg(2) function. The control part of this message contains a log_ctl structure, which
specifies the mid, sid, level, flags, time in ticks since boot that the message was submitted,
the corresponding time in seconds since Jan. 1, 1970, a sequence number, and a priority.
The time in seconds since 1970 is provided so that the date and time of the message can
be easily computed, and the time in ticks since boot is provided so that the relative timing
of log messages can be determined.
struct log_ctl {
short mid;
short sid;
char level; /level of message for tracing /
short flags; /message disposition /
clock_t ltime; /time in machine ticks since boot /
time_t time; /time in seconds since 1970 /
long seq_no; /sequence number /
int pri; /priority = (facility|level) /
};
The priority consists of a priority code and a facility code, found in <sys/syslog.h>.If
SL_CONSOLE is set in flags, the priority code is set as follows: If SL_WARN is set, the
priority code is set to LOG_WARNING;IfSL_FATAL is set, the priority code is set to
LOG_CRIT;IfSL_ERROR is set, the priority code is set to LOG_ERR;IfSL_NOTE is set, the
priority code is set to LOG_NOTICE;IfSL_TRACE is set, the priority code is set to
LOG_DEBUG; If only SL_CONSOLE is set, the priority code is set to LOG_INFO. Messages
originating from the kernel have the facility code set to LOG_KERN. Most messages ori-
ginating from user processes will have the facility code set to LOG_USER.
Different sequence numbers are maintainedfor the error and trace logging streams, and
are provided so that gaps in the sequence of messages can be determined (during times
of high message traffic some messages may not be delivered by the logger to avoid hog-
ging system resources). The data part of the message contains the unexpandedtext of the
format string (null terminated), followed byNLOGARGS words for the arguments to the
format string, aligned on the first word boundary following the format string.
A process may also send a message of the same structure to log, even if it is not an error
or trace logger. The only fields of the log_ctl structure in the control part of the message
that are accepted are the level, flags, and pri fields; all other fields are filled in by log before
being forwarded to the appropriate logger. The data portion must contain a null ter-
minated format string, and any arguments (up to NLOGARGS) must be packed, one
word each, on the next word boundary following the end of the format string.
7D-196 modified 23 Feb 1994