Skip to main content

Adding Trace Elements

Adding Trace Elements

Tracing is a tool for use primarily during development. You add trace elements so that you can see the behavior of various elements in a production, for the purpose of debugging or diagnosis. To add trace elements to a production, you identify the areas in your code (typically business host classes) where you would like to see runtime information. In those areas, you add lines of code that (potentially) write trace messages. Note that these are messages only in a general sense; trace messages are simply strings and are unrelated to Ens.Message and its subclasses.

In most cases, you can define two kinds of trace elements: user elements and system elements. In most cases, it is more appropriate to define user trace elements.

Note:

For information on writing trace elements in BPL, DTL, or business rules, see Developing BPL Processes, Developing DTL Transformations, and Developing Business Rules.

Also, for information on enabling tracing, see the chapter “Enabling Tracing” in Monitoring Ensemble.

Writing Trace Messages in ObjectScript

To write trace messages in ObjectScript, use the following lines of code:

  • To write a user trace message:

     $$$TRACE(trace_message)

    Where trace_message is a string containing useful information about the context in which you add this line of code.

  • To write a system trace message (less common):

     $$$sysTRACE(trace_message)

    You might see $$$sysTRACE in Ensemble system code, but the appropriate choice for your own business host classes is generally $$$TRACE.

For example:

$$$TRACE("received application for "_request.CustomerName)

Writing Trace Messages in Basic

To write trace messages in Caché Basic, use the following lines of code:

  • To write a user trace message:

    "Ens.Util.Trace".WriteTrace("user",Me.%ClassName(1),CurrentMethod,arg)

    Where CurrentMethod is the name of the current method and arg is the string that you want written to the console.

  • To write a system trace message (less common):

    "Ens.Util.Trace".WriteTrace("system",Me.%ClassName(1),CurrentMethod,arg)

Writing Trace Messages in BPL or DTL

To write user trace messages in a BPL business process or in a DTL data transformation, use the <trace> element. See the Ensemble Business Process Language Reference or the Ensemble Data Transformation Language Reference.

FeedbackOpens in a new tab