The Trace Facility helps you isolate problems and debug your code either during the application development phase or in run time. By enabling the trace mechanism, you can see the values of code variables while the application is running, the code path being executed, and other useful information. You decide which information will be traced and where it will be kept.
The Trace Facility provides a class (invoked either from the application or from infrastructure classes) that keeps tracing information in memory and optionally on disk. It also provides a viewer tool, which lets you browse the trace entries in memory and make dynamic changes to some aspects of the tracing behavior. You initialize the tracing configuration by specifying settings in the toolkit configuration file, and change them dynamically at run time using an API.
Trace records can be created by a call from the application or any toolkit component, and are reported to the display, to a file, or to the WebSphere(R) Application Server console or logs.
Trace entries can be permanently included in the code, and activated when required. Tracing is neither memory-intensive nor expensive in terms of performance. Each entity that calls the Trace Facility is free to trace any required information that can be expressed as a text string of 1024 bytes or less. The maximum width of the reported trace line (to both the display and the file) is adjustable to a maximum of 512 bytes. The default line length is 128 bytes.
You can use different categories of tracing to configure the trace system according to your needs. Each trace call is associated with a component, a level, and a type that specifies a trace record. Whether or not the trace call results in a trace report depends on whether the trace records for the specified component, level, and type are enabled for tracing.
You can configure the reporting of trace records according to component, trace level, and trace type. These settings are read from the toolkit configuration file for use at initialization, and can be changed dynamically at run time using the API. The viewer tool can also be used to configure the trace system. The Trace system's public API allows an application to check for enabled types and levels for a given component before invoking the Trace Facility; this avoids unnecessary trace calls. You can also force disabled trace reports from a component by using an API method that bypasses the record-enabling mechanism.