Starting a Trace and Reading a Trace Buffer

Start a new trace by specifying ttTraceMon datastore. For example, to start a trace on the database1 database, enter:

%  ttTraceMon database1
Trace monitor; empty line to exit
Trace >

At the Trace prompt, specify the type of trace and its level. For example, to start tracing the SQL component at level 3, enter:

Trace > level sql 3

At this point you can run your application and the TimesTen trace information is written to a trace buffer. There are two ways to read the contents of the trace buffer:

  • From the Trace prompt, use the outfile command to direct the trace buffer data to a file. You must do this before running your application. When writing tracing information to a file, new trace information is concatenated to the existing contents of the file.

  • From the Trace prompt, use the dump command to display the trace buffer data to your screen.

Note:

The contents of the trace buffer accumulate with each new trace. To clear the trace buffer, use the flush command from a ttTraceMon prompt. Clear the buffered trace records for a specific component by specifying the component with the flush command.

Each record from the trace buffer has the following format:

timestamp   sequence   component   level   connection   processid
   operation

The fields in the records are defined as follows:

  • timestamp is the time at which the operation was executed.

  • sequence is the incremental number that identifies the trace line.

  • component is the TimesTen component being traced (such as SQL, API, LOCK, or ERR).

  • level is the trace level associated with the trace line. The range of trace levels differs by component, but for all components, the lowest trace level generates the least verbose output and highest trace level generates the most verbose output. For example, if you are tracing SQL at level 4, your output includes lines for levels 2 (prepare), 3 (execute), and 4 (open, close, fetch).

Note:

Trace levels for some components are not a continuous range of numbers. If you enter a number that does not correspond to a supported level for a component, tracing occurs at the highest supported level that is less than the number you entered. For example, if tracing levels for a component are 1, 2, 3, 4, and 6 and you enter 5, tracing events for level 1, 2, 3, and 4 are generated.

  • connection is the internal connection ID identifying the connection that generated the trace. This number corresponds to the ConnID shown in the ttStatus output. The connection ID is also used as the first element of the transaction ID.

  • processid is the operating system process ID for the process that generated the trace.

  • operation is the operation that occurred (such as SQL statement, API operation, or error message).

For example, a line from the trace buffer after a SQL trace at level 3 might look like this:

10:39:50.231 5281 SQL 2L 1C 3914P Preparing: select cust_num from customer