In a session-managed application, you can access the current connection ID using the SERVER-CONNECTION-ID attribute on the SESSION handle. In a session-free or session-managed application, you can access the ClientContextId property on the Progress.Lang.OERequestInfo class instance referenced by the SESSION handle's CURRENT-REQUEST-INFO attribute.
Ideal locations to generate an audit trail in a session-managed application include the Connect and Disconnect procedures. For example, your Connect procedure can use the user-id parameter and the SERVER-CONNECTION-ID attribute or ClientContextId property value to write an audit trail record when a client application connects to the server. Also, any code to create an audit trail record in the Disconnect procedure is always executed, since this procedure is guaranteed to run whether the connection is explicitly disconnected or forcibly disconnected in response to the QUIT condition.
In a session-free or unbound session-managed application, you can also use the Activate and Deactivate procedures to generate audit trails for each request. However, this use can reduce performance, depending on the load on your server and the amount of information in the audit trail.
Note: Audit information created in a server session using the MESSAGE statement or other external output syntax such as the DISPLAY statement, is sent to the PAS for OpenEdge instance log file unless otherwise directed.