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 Enabling Tracing.

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 InterSystems IRIS 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 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 Business Process and Data Transformation Language Reference or the Data Transformation Language Reference.

FeedbackOpens in a new tab