Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Auditing : Recording application events : Instructing OpenEdge to record an application event
 
Instructing OpenEdge to record an application event
The basic method for generating an application event is the AUDIT-CONTROL:LOG-AUDIT-EVENT( ) method, using the following syntax:

Syntax

LOG-AUDIT-EVENT( event-id, event-context [, event-detail
  [, user-detail ] ] )
Invoking this method generates the audit event in any connected and audit-enabled database whose active audit policies also enable this event, identified by its event-id. The method returns a character string containing a universally unique identifier (UUID) that serves as a primary index for the generated audit event record. For more information on UUIDs, see the sections on managing identities in ApplicationSecurity .
You can specify any integer value from 32000 or greater as the event-id. The remaining values can specify any character strings that you find helpful in describing this event. This information is designed to indicate, respectively, some context information for this instance of the event (event-context, which is an alternate index for querying the audit event record), any more detailed information about the event (event-detail), and any information about the application user associated with the auditing ID for the event (user-detail), which you might obtain from attributes of the client-principal object.
Note: As you invoke this method, you might keep notes on the values you set to help provide documentation for creating the event and audit policies for event in the database at application deployment sites.
The following code fragment shows how you might code this method:
DEFINE VARIABLE iEmployeeReadEvent AS INTEGER   NO-UNDO INITIAL 32000.
DEFINE VARIABLE caEventPrimaryKey  AS CHARACTER NO-UNDO EXTENT 100.
DEFINE VARIABLE iEventIdx          AS INTEGER   NO-UNDO.
...
iEventIdx = iEventIdx + 1.
caEventPrimaryKey[iEventIdx] =
  AUDIT-CONTROL:LOG-AUDIT-EVENT(iEmployeeReadEvent, "First record read.").
This example assembles a list of generated application events in order of occurrence by storing the generated UUID returned for each event in an array for later reference.