How to Trace a Session with Forms Trace in Oracle Forms

Record user actions, triggers, built-ins, and SQL of an Oracle Forms 14.1.2 session with Forms Trace, and read the trace with Xlate.

Some problems appear only on the server, only for one user, or only under real load, where the debugger cannot follow. Forms Trace records what a session does, user actions, triggers, program units, built-ins, and SQL, with the time of each in milliseconds since the session started.

This guide shows how to start a Forms Trace in Oracle Forms 14.1.2, choose what to trace with event numbers and groups, translate the binary trace to text with Xlate, and read two real traces.

Sample Form for This Guide

The examples and screenshots use the sample forms CH34_TRIPS and CH34_PERF_A100 from the Oracle Forms code repository on GitHub. Download them, open them in Forms Builder, and connect as CAREWELL to follow along.

FormFileWhat it shows
CH34_TRIPSforms/ch34/ch34_trips.fmbEight items and a clock, traced for user actions
CH34_PERF_A100forms/ch34/ch34_perf_a100.fmbThe performance form with a Query Array Size of 100, traced for SQL and triggers

The forms run against the CareWell Clinic sample schema, which you install first.

Forms Trace at a Glance

StepHow
Start a tracerecord=forms and tracegroup in the URL or configuration section, or from User Sessions in Fusion Middleware Control.
Choose eventsEvent numbers, ranges, or a group defined in ftrace.cfg.
Find the fileforms_<process id>.trc in the domain's system_components/FORMS/forms1/trace directory.
Read itTranslate it with the Xlate utility to text, HTML, or XML.

Start a Trace

A trace is started for a session in one of two ways:

  • In the URL or the configuration section: record=forms, and tracegroup with the events to trace.
  • In Fusion Middleware Control, from User Sessions, for a session already running.

Both parameters are formsweb.cfg parameters, listed in how to configure formsweb.cfg in Oracle Forms.

Choose the Events to Trace

tracegroup names event numbers or ranges, or a group defined in ftrace.cfg, in the Forms instance's server directory. Oracle's file defines three groups.

The groups in ftrace.cfg:

debug: 0-159,169-196
errors: 0-3
custom1: 32-46,65,66,96,194

The events, by number:

EventsRecorded
0 to 3Errors and fatal errors.
32 to 47Startup, and user actions: menu, key, click, value, scroll, LOV selection, window events, tab page, timer, database event.
64 to 71Durations: form, program unit, trigger, LOV, editor, canvas, alert.
96 to 101Built-ins, user exits, SQL, menu creation, database program units, Execute Query.
128 to 137Network: connect, handshake, heartbeat, HTTP, socket, SSL, database processing, logon, logoff.
192 to 196Details of other events: environment, state changes, arguments of built-ins, user exits, program units.

Translate the Trace with Xlate

Each trace is a file named after the runtime process, such as forms_18329.trc, in the domain's system_components/FORMS/forms1/trace directory. It is binary; the Xlate utility, in frmxlate.jar, translates it to text, HTML, or XML.

Translate a trace to text:

java -cp $ORACLE_HOME/jlib/frmxlate.jar oracle.forms.diagnostics.Xlate
     datafile=forms_18329.trc outputfile=trace.txt outputclass=WriteOutTEXT

Read a Trace: User Actions

The sample trips form, which has eight text items and a clock, was run with record=forms&tracegroup=custom1. The user typed a name, pressed Tab, and started the clock.

Output:

#1 [Startup]  Timestamp=10, PName=USER_START, ProcessID=18329, Tracegroup=custom1
#2 [WINDOW_ACTIVATE]  Timestamp=410, FormID=1, Name=MAIN_WIN, Width=420, Height=230
#3 [Key]  Timestamp=26330, FormID=1, KeyPressed=Next_item
#4 [CLICK]  Timestamp=27510, FormID=1, Block=CTL, Item=START, How=MOUSE
 5 [TRIGGER.START,1]  Timestamp=27510, EndEvent=10, Block=CTL, Item=START, Name=WHEN-BUTTON-PRESSED
 7 [BUILTIN.START,3]  Timestamp=27540, EndEvent=8, Name=CREATE_TIMER
  [Arguments]
    Type=In Position=1 DataType=STRING Value=CLOCK
    Type=In Position=2 DataType=NUMBER Value=1000
 8 [BUILTIN.END,3]  Timestamp=27550, StartEvent=7, Duration=10
10 [TRIGGER.END,1]  Timestamp=27550, StartEvent=5, Duration=40
#11 [TIMER]  Timestamp=28550, FormID=1, Name=CLOCK
12 [TRIGGER.START,1]  Timestamp=28550, EndEvent=15, Block=(Null), Item=(Null), Name=WHEN-TIMER-EXPIRED

Point events are marked #; duration events come in pairs, the end with its Duration. The typing is not there, because it never reached the server, while the Tab is, as the key Next_item. That matches the request counts in how to reduce round trips to the Forms server.

Read a Trace: SQL and Triggers

With tracegroup=66,98,101, the trace of the One Call button in the performance form with a Query Array Size of 100 listed the block's statement and each POST-QUERY: 5,371 events for one button, which took 470 milliseconds.

Output:

 2 [TRIGGER.START,1]  Timestamp=25030, EndEvent=5371, Block=CTL, Item=CALL, Name=WHEN-BUTTON-PRESSED
 3 [EXECQUERY.START]  Timestamp=25060, EndEvent=46, FormID=1, Block=APPTS
 4 [SQL.START]  Timestamp=25070, EndEvent=5, Statement=SELECT ROWID,APPT_ID,APPT_START,
                   PATIENT_ID,DOCTOR_ID FROM APPOINTMENTS  order by appt_id
 8 [TRIGGER.START,2]  Timestamp=25070, EndEvent=9, Block=APPTS, Item=(Null), Name=POST-QUERY
5371 [TRIGGER.END,1]  Timestamp=25500, StartEvent=2, Duration=470

The form behind this trace is described in how to reduce database round trips in Oracle Forms.

Trace Only What You Need

The trace file grows with every event, and tracing slows the session. Trace only the event groups the problem needs, for as long as it takes to reproduce it, and turn the trace off afterward. For stepping through code interactively instead, see how to debug Oracle Forms using the Forms Debugger.

Conclusion

Forms Trace records a session's events by number: start it with record=forms and a tracegroup of event numbers, ranges, or ftrace.cfg groups, or from User Sessions in Fusion Middleware Control. The binary forms_<pid>.trc file becomes readable text, HTML, or XML with Xlate, showing point events, paired start and end events with durations, built-in arguments, and SQL. Trace only what the problem needs, because every event costs file space and session time.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE and software veteran with 25+ years of experience, passionate about AI and IT innovation.

guest

0 Comments
Oldest
Newest Most Voted
00