Click or drag to resize

Appendix B (Tracing)

Home
APPENDIX B (TRACING)

Traces are the publishing of specific messages that are generated during application execution. When using tracing, you must have a mechanism for collecting and recording the messages that are sent. Trace messages are received by listeners.

Enabling Tracing

To enable traces during transaction processing, you should edit application configuration file (‘CASOpcDaWrapper.exe.config’) which is located in the CommServer installation folder (default location: ‘C:\Program Files\CommServer’).

Trace Level

Description

Critical

Serious failures, such as the following, have occurred:

  • An error that can cause an immediate loss of user functionality.

  • An event that requires an administrator to take action to avoid loss of functionality.

  • Code hangs.

This tracing level can also provide sufficient context for interpreting other critical traces. This can help to identify the sequence of operations leading to a serious failure.

Error

An error (e.g. invalid configuration or network behavior) has occurred that can result in loss of user functionality.

Warning

A condition exists that can subsequently result in an error or critical failure (e.g. allocation failing or approaching a limit). Normal processing of errors from user code (e.g. transaction aborted, timeouts, authentication failed) can also generate a warning.

Warning

A condition exists that can subsequently result in an error or critical failure (e.g. allocation failing or approaching a limit). Normal processing of errors from user code (e.g. transaction aborted, timeouts, authentication failed) can also generate a warning.

Information

Messages helpful for monitoring and diagnosing the system status, measuring performance or profiling are generated. They can include transaction and enlistment lifetime events, such as a transaction being created or committed, the crossing of a significant boundary or the allocation of significant resources. A developer can then utilize such information for capacity planning and performance management.

Tracing switches

Trace switches allow you to enable, disable, and filter tracing output. They are objects that exist in software and can be configured externally through the ‘CASOpcDaWrapper.exe.config’ file. Trace switches can be useful for filtering information. For example, you want to see every tracing message in a data access module, but only error messages in the rest of the application. In that case, use one trace switch for the data access module and one switch for the rest of the application. Using the ‘CASOpcDaWrapper.exe.config’ file to configure the switches to the appropriate settings, you will be able to control what types of trace messages you receive. Levels allow you to limit the amount of tracing information you receive to information needed to solve a problem only. To specify the level of detail you want in your tracing output set and configure trace switches to the appropriate trace level. You can receive the following messages:

Enumerated value

Integer value

Type of message displayed (or written to a specified output target)

Off

0

None

Error

1

Only error messages

Warning

2

Warning messages and error messages

Info

3

Informational messages, warning messages and error messages

Verbose

4

Verbose messages, informational messages, warning messages and error messages

Tracing sources

Trace sources are a feature that provides an enhanced tracing system. The basic premise is unchanged: tracing messages are sent through switches to listeners, which report the data to an associated output medium.

Tracing listeners

Trace messages are received by listeners. The purpose of a listener is to collect, store, and route tracing messages. Listeners direct the tracing output to an appropriate target, such as a log, window, or text file. One such listener, the DefaultTraceListener, is automatically created and initialized when tracing is enabled. If you want trace output to be directed to any additional sources, you must create and initialize additional trace listeners. The listeners you create should reflect your individual needs. For example, you want a text record of all trace output. In this case, create a listener that writes all output to a new text file when enabled. There are several types of predefined listeners:

  • TextWriterTraceListener outputs information as a text to the console or to a file

  • EventLogTraceListener redirects output to an event log.

  • ConsoleTraceListener directs tracing or debugging output to either the standard output or the standard error stream.

  • DelimitedListTraceListener directs tracing or debugging output to a text writer, such as a file stream. The trace output is in a delimited text format that uses the delimiter specified by the Delimiter property. (this is a useful option to have an output in CSV format)

  • XmlWriterTraceListener directs tracing or debugging output as XML-encoded data to a file stream. (this is a useful option to have an output in XML format)

Tracing filters

A trace filter can be added to a trace listener to provide a layer of screening in addition to that provided to the trace source by switches. For example, EventTypeFilter can be added to a trace listener to control the event types that are output by the listener. Listeners that are called because the switch criteria are met can query their filter, if present, to determine if a trace is to be sent to output.

One of several different types of filters can be assigned to a trace listener through the Filter property to provide a layer of screening in addition to that provided by the TraceSwitch. The filter can be used to control the event types that are produced by the listener.

See Also