PLOG_EVENT_ROUTINE callback function (resapi.h)

Records an event in the cluster log. The PLOG_EVENT_ROUTINE type defines a pointer to this function.

Syntax

PLOG_EVENT_ROUTINE PlogEventRoutine;

void PlogEventRoutine(
  [in] RESOURCE_HANDLE ResourceHandle,
  [in] LOG_LEVEL LogLevel,
  [in] LPCWSTR FormatString,
       ... unnamedParam4
)
{...}

Parameters

[in] ResourceHandle

Handle identifying the resource recording the event. The value for ResourceHandle should be the handle passed in during the Open call for this resource.

[in] LogLevel

Value enumerated by the LOG_LEVEL enumeration that represents the log level of the event and that is for information only. The following valid values are shown in order from least to most severe.

LOG_INFORMATION (0)

The event is informational.

LOG_WARNING (1)

The event is reporting a failure that might have happened, but it is uncertain whether a failure really did occur.

LOG_ERROR (2)

The event affects a single component, but other components are not affected and the integrity of the rest of the node is not compromised.

LOG_SEVERE (3)

The event is reporting a severe failure that affects multiple components, or the integrity of the entire system is compromised or believed to be compromised.

[in] FormatString

Null-terminated Unicode string that includes the information to be recorded. This string must be in the same format as that passed to the FormatMessage function.

unnamedParam4

Return value

None

Remarks

The LogEvent callback function is implemented by the Resource Monitor and is called by a resource DLL to report events and errors to the cluster log. Resource DLLs receive a pointer to the LogEvent callback function in the LogEvent parameter to their Startup entry-point function.

LogEvent does not write entries to the event log. To report events in the event log, a resource DLL must call the ReportEvent function.

The format of the logged message appears as follows:

ResourceTypeName ResourceName: message

ResourceTypeName is the resource type, such as "Generic Application". The specific resource name is the user-friendly name for the specific resource, and message is the message delivered by the resource DLL to the Resource Monitor.

The log entry size is limited to 500 characters.

Examples

The following example is based on code generated by the Cluster Resource Type Wizard. For additional examples, see Resource DLL Examples.

//  The following parameters are assumed to be already defined:
//  g_pfnLogEvent   Stores the address of the LogEvent callback
//                  function passed to the DLL in the
//                  Startup entry point.
//  pResourceEntry  Stores resource instance data.
//  MY_SVCNAME      Stores the name of a service.
//  nStatus         Result

//  Log the fact that an attempt to start a service has failed.

//  Basic message
    (g_pfnLogEvent)( pResourceEntry->hResourceHandle,
                     LOG_ERROR,
                     L"Failed to start the specified service.\n" );

//  Message w/string argument
    (g_pfnLogEvent)( pResourceEntry->hResourceHandle,
                     LOG_ERROR,
                     L"OnlineThread: Failed to start the '%1' service.\n",
                     MY_SVCNAME );

//  Message w/multiple arguments
    (g_pfnLogEvent)( pResourceEntry->hResourceHandle,
                     LOG_ERROR,
                     L"OnlineThread: Failed to start the '%1' service. Error: %2!u!.\n",
                     MY_SVCNAME,
                     nStatus );

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2008 Enterprise, Windows Server 2008 Datacenter
Target Platform Windows
Header resapi.h

See also

LOG_LEVEL

Open

ReportEvent

Resource DLL Callback Functions

Startup