Sun Java System Directory Server Enterprise Edition 6.2 Developer's Guide

slapi_log_warning_ex()

Write a warning message to the server error log.

Syntax

#include "slapi-plugin.h"
int slapi_log_warning_ex(long warningId,
    long msgId, int connId, int opId, char const * subsystem,
    char const * humanReadableMsg, char const * fmt, /* args */ ...);

Parameters

This function takes the following parameters:

warningId

Unique identifier you provide for this warning message

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

humanReadableMsg

String message identifying this warning

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.

Unlike slapi_log_info_ex(), this function cannot be turned off.

Warning messages typically concern potentially serious situations, but not fatal errors. For fatal errors, use slapi_log_error_ex(). For informational log messages, use slapi_log_info_ex().

Example

Example 16–4 shows a call to slapi_log_warning_ex().


Example 16–4 Logging a Warning


#include "slapi-plugin.h"
#include "example-com-warning-ids.h" /* example.com unique
                                        warning IDs file  */
int
foobar()
{
    int disk_use_percentage;

    /* ... */

    if (disk_use_percentage >= 95){
        slapi_log_warning_ex(
            EXCOM_DISK_FULL_WARN,    /* unique warning ID */
            SLAPI_LOG_NO_MSGID,
            SLAPI_LOG_NO_CONNID,
            SLAPI_LOG_NO_OPID,
            "example.com: foobar in baz plug-in",
            "disk %.0f%% full, find more space\n",
            (float)disk_use_percentage
        );
    }
    return 0;
}

Returns

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

See Also

slapi_log_error_ex()

slapi_log_info_ex()