








Windows NT Event Logging Service
|
Ver. 1.00
Contributed by Roy Kiesler |
This is an extension to the PFC error service. It provides the capability to log error
messages in the Windows NT event log instead of the standard text file or database. |
|
The Object
n_cst_error_nt inherited from n_cst_error. |
Object Functions
Function |
Description |
of_SetRange |
Defines a range of error severity values for each type of
event. |
of_GetRange |
Determines the event type
for a given severity value. |
of_ProcessLog |
Adds an entry in the Windows NT event log (overriding
ancestor.) |
Enabling The Service
The service is enabled by calling an overridden version n_cst_appmanager's
of_SetError() function, as shown in listing 1 below. |
|
Listing
1: Override of function of_SetError() for n_cst_appmanager object |
//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetError
//
// Access: public
//
// Arguments:
// ab_switch True - start (create) the service,
// False - stop (destroy) the service
//
// Returns: Integer
// 1 - Successful operation.
// 0 - No action taken.
// -1 - An error was encountered.
//
// Description: Starts or stops the Error Handling Service. This function is
// overloaded to create an error service with NT event logging
// features instead of the standard PFC n_cst_error object.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
// Check arguments
IF IsNull(ab_switch) THEN
RETURN -1
End IF
// Check operating system
IF this.ienv_object.OSType <> WindowsNT! THEN
RETURN -1
END IF
IF ab_Switch THEN
IF IsNull(inv_error) OR NOT IsValid (inv_error) THEN
inv_error = CREATE n_cst_error_nt
inv_error.of_SetUser( this.of_GetUserID() )
RETURN 1
END IF
ELSE
IF IsValid (inv_error) THEN
DESTROY inv_error
RETURN 1
END IF
END IF
RETURN 0
|
Using The Service
After enabling the service with of_SetError( TRUE ), you should call the of_SetRange()
function to map your application specific error severity values to the 4 Windows NT event
types (success, error, warning and information. Default ranges are specified in the
instance variable section of the object.) The file error_nt.pbl contains a small PFC
application that demonstrates the use of all functions in this service. |
Revision History |
04/01/1998 |
Initial
Revision |
Ver. 1.00 |
Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.
For information or suggestions about
this web site please contact webmaster@pfcguide.com
PFCGuide is
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a
contract or a liability against Dynamic
Technology Group.
Last Revised: February 15, 2004 03:58 AM.