Chapter 30. Functions for Logging

This chapter contains reference information on logging routines.

Table 30.1. Logging Routines

Function Description
slapi_log_error() Writes a message to the error log for the Directory Server.
slapi_is_loglevel_set() Checks if loglevel is selected as a log level.

30.1. slapi_log_error()

Writes a message to the error log for the Directory Server. By default, the error log file is /var/log/dirsrv/slapd-instance/errors.
Syntax

#include "slapi-plugin.h"
 int slapi_log_error( int severity, char *subsystem, char *fmt, ... );

Parameters

This function takes the following parameters:

severity
Level of severity of the message. In combination with the severity level specified by the administrator, this determines whether the message is written to the log.
subsystem
Name of the subsystem in which this function is called. The string that you specify here appears in the error log in the following format: subsystem_name:message
fmt, ...
Message that you want written. This message can be in printf()-style format.
For example:..., %s\n,myString);
The severity argument corresponds to the Log Level setting selected by in the Server Manager under Server Preferences | LDAP. If a Log Level setting is selected, messages with that severity level are written to the error log. The severity argument can have one of the following values:
SLAPI_LOG_FATAL
Always written to the error log. This severity level indicates that a fatal error has occurred in the server.
SLAPI_LOG_TRACE
Written to the error log if the Log Level setting "Trace function calls" is selected. This severity level is typically used to indicate what function is being called.
SLAPI_LOG_PACKETS
Written to the error log if the Log Level setting "Packet handling" is selected.
SLAPI_LOG_ARGS
Written to the error log if the Log Level setting "Heavy trace output" is selected.
SLAPI_LOG_CONNS
Written to the error log if the Log Level setting "Connection management" is selected.
SLAPI_LOG_BER
Written to the error log if the Log Level setting "Packets sent/received" is selected.
SLAPI_LOG_FILTER
Written to the error log if the Log Level setting "Search filter processing" is selected.
SLAPI_LOG_CONFIG
Written to the error log if the Log Level setting "Config file processing" is selected.
SLAPI_LOG_ACL
Written to the error log if the Log Level setting "Access control list processing" is selected.
SLAPI_LOG_SHELL
Written to the error log if the Log Level setting "Log communications with shell backends" is selected.
SLAPI_LOG_PARSE
Written to the error log if the Log Level setting "Log entry parsing" is selected.
SLAPI_LOG_HOUSE
Written to the error log if the Log Level setting "Housekeeping" is selected.
SLAPI_LOG_REPL
Written to the error log if the Log Level setting "Replication" is selected.
SLAPI_LOG_CACHE
Written to the error log if the Log Level setting "Entry cache" is selected.
SLAPI_LOG_PLUGIN
Written to the error log if the Log Level setting "Plug-ins" is selected. This severity level is typically used to identify messages from server plug-ins.
Returns

This function returns one of the following values:

  • 0 if successful.
  • -1 if an unknown severity level is specified.