7.3 Use the Trace Handler

After creating a Trace Handler it can be added to your application. This can be done as part of the initialization with a simple Define_Com statement. For example, if the Trace Handler was created as a component called Tracing, add a statement like:

Define_Com Class(#Tracing) name(#TraceHandler)

 

If you are using the 7.2 Example Trace Handler this is all you need to do to expose the Trace Handler for use in your application. It is a self contained object that will set itself as the system trace handler if a suitable trigger condition is satisfied. In the example this is the existence of file TracingOn.txt in the system source folder.

You are now ready to start adding tracing commands to your application source at places of interest in the RDML code. There are two methods available to do this TraceMessageText and TraceMessageData

TraceMessageText supports four variant input parameters. When used the TraceMessage method in the Trace Handler will be executed once for each of the variables specified.

#Sys_Appln.TraceMessageText(#Empno #Givename #Surname)
 

TraceMessageData has a source parameter and nine variant parameters. The variant parameters are substituted into the source parameter as if the Substitute intrinsic were being used.

#Sys_Appln.TraceMessageData("Employee &1 Name &2 &3" #Empno #Givename #Surname)
 

Refer to 7.4 Example Use of Tracing for a sample form incorporating trace commands.