Sun Directory Server Enterprise Edition 7.0 Developer's Guide

slapi_log_info_ex()

Write an informational message to the server error log.

Syntax

#include "slapi-plugin.h"
int slapi_log_info_ex(slapi_log_info_area_t area,
    slapi_log_info_level_t level,
    long msgId, int connId, int opId, char const * subsystem,
    char const * fmt, /* args */, ...);

Parameters

This function takes the following parameters:

area

Identifies the server component so logging can be turned on by adding the decimal value of the area to the value for nsslapd-infolog-area. Subtract from the value to turn informational logging off.

level

Identifies whether the server should log this message when informational logging is activated for area.

When informational logging is activated, setting level to:

  • SLAPI_LOG_INFO_LEVEL_DEFAULT means always log the message.

  • SLAPI_LOG_INFO_LEVEL_EXTRA means only log if the value of nsslapd-infolog-level is greater than 0.

msgId

Identifier for the current message obtained using SLAPI_OPERATION_MSGID

connId

Identifier for the current connection obtained using SLAPI_CONN_ID

opId

Identifier for the current operation obtained using SLAPI_OPERATION_ID

subsystem

String indicating the context in which the warning arose such as the name of the plug-in function logging the message

fmt

Format specification in the style of printf()

args

Arguments for the format specification in fmt

Description

This function writes the specified error message to the server error log in synchronous fashion. This function does not return until the log message has been flushed to disk, thus blocking the server for the duration of the write operation. By default, the error log is $INSTANCE_PATH/logs/errors.

This function is turned off by default. Activate logging of the message with the dsconf set-log-prop command.

You can also manage logs using Directory Service Control Center.

Informational message are typically those that system administrators may ignore unless trying to debug server behavior. For errors, use slapi_log_error_ex() . For warnings, use slapi_log_warning_ex().

Example

Example 15–3 shows a call to slapi_log_info_ex().


Example 15–3 Logging an Informational Message

#include "slapi-plugin.h"

int
hello()
{
    slapi_log_info_ex(
        SLAPI_LOG_INFO_AREA_PLUGIN,
        SLAPI_LOG_INFO_LEVEL_DEFAULT,
        SLAPI_LOG_NO_MSGID,
        SLAPI_LOG_NO_CONNID,
        SLAPI_LOG_NO_OPID,
        "hello() from a plug-in",
        "Hello, World!\n"
    );
    return 0;
}

Returns

This function returns 0 if successful. Otherwise, it returns -1.

See Also

slapi_log_error_ex()

slapi_log_warning_ex()