Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

TraceOn Method


TraceOn turns on the tracking of allocations and deallocations of Siebel objects and SQL statements generated by the Siebel application.

Syntax

Application.TraceOn(filename, type, selection)

Argument
Description

filename

Output filename for the trace messages. If this argument is not specified, tracing information is logged to the Object Manager log file for that user session.

The filename argument can take two additional inline arguments: $p and $t. The $p argument substitutes the process id to the filename, and $t substitutes the thread id to the file name. For example:

TheApplication().TraceOn("d:\\temp\\trace_$p_$t.txt", "Allocation", "All");

would log trace files to d:\temp\trace\trace_1496_1412.txt. Place a separator between the $p and $t arguments to make sure that the filename argument is unique. For example, if user A had a process id of 1 and a thread of 12 without using a separator, the tracing file would be

d:\temp\trace_112.txt

If user B had a process id of 11, and a thread id of 2, the tracing file would be

d:\temp\trace_112.txt

As a result, both users would attempt to log to the same file. Adding a separator between the process and thread id keeps the filenames unique.

d:\temp\trace_1_12.txt

d:\temp\trace_11_2.txt

type

Specifies the type of tracing to start. This can have the following values:

  • Allocation. Traces allocations and deallocations of Siebel objects. This option is useful if you suspect memory leaks in your code.
  • SQL. Traces SQL statements generated by the Siebel application.

selection

Indicates which Siebel objects should be traced for the Allocation trace type. This argument should be "" if the trace type is SQL.

  • Script. Traces VB and eScript objects.
  • OLE. Traces allocations for data server or automation server programs.
  • All. Traces all objects. The All value does not trace the Siebel objects managed implicitly by Siebel's declarative configuration use. All traces the Siebel objects constructed by scripting.
Returns

Not applicable

Usage

Always issue TraceOff to turn off tracing. If you attempt to call TraceOn with a different filename without calling TraceOff first, trace information is written to the new trace filename. The old file is left open (locked). You can issue multiple TraceOn statements to the same trace file.

NOTE:  This method and the Trace Method are meant for debugging purposes and are not recommended for use in production environments.

Used With

COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script

Example

The following example is for COM Data Server. SiebelApplication is an Application instance:

Private Sub TraceOn_Click()
   Dim ErrCode As Integer
   SiebelApplication.TraceOn "c:\temp\trace.txt", "allocation",
      "all",       ErrCode
   If (ErrCode = 0) Then SiebelApplication.TraceOn
      "c:\temp\trace.txt",      "SQL", "",ErrCode   
   If (ErrCode = 0) Then SiebelApplication.Trace
      "Start of Tracing!",
      ErrCode
End Sub

The following example is in Siebel eScript:

function BusComp_PreSetFieldValue (FieldName, FieldValue)

{
TheApplication().TraceOn("d:\\temp\\trace.txt", "Allocation", "All");
TheApplication().TraceOn("d:\\temp\\trace.txt", "SQL", "");
TheApplication().Trace("start tracing!");

return (ContinueOperation);
}

The following example is in Siebel VB:

Sub Button2_Click
   TheApplication.TraceOn "C:\temp\trace.txt", "allocation",
      "all"
   TheApplication.TraceOn "C:\temp\trace.txt", "sql", ""
   TheApplication.Trace "start of tracing!"
End Sub

The following is sample output of an Allocation trace section:

03/05/98,17:27:47,START,4.0.4 [1425_P3] ENU
03/05/98,17:27:47,ALLOC,1,BusObject,Account,Basic
03/05/98,17:27:48,ALLOC,2,BusComp,Account,Basic
03/05/98,17:27:48,RELEASE,1
03/05/98,17:27:48,RELEASE,2

The following is sample output of an SQL trace section:

01/22/98,21:03:49,START,4.0.2 [1416] ENU
01/22/98,21:04:02,COMMENT,Start of Tracing!
01/22/98,21:04:10,SQLSTMT,1,SELECT,"SELECT
   T1.ROW_ID,
   T1.MODIFICATION_NUM,
   T1.CREATED_BY,
   T1.LAST_UPD_BY,
   T1.CREATED,
   T1.LAST_UPD,
   T1.CONFLICT_ID,
   T1.NAME,      
   T1.DESC_TEXT,
   T1.PRIV_FLG,
   T1.QUERY_STRING
FROM
   DEV32.S_APP_QUERY T1
WHERE
   (T1.CREATED_BY = :1 OR T1.PRIV_FLG = :2) AND
   ((T1.NAME LIKE :3 OR T1.NAME LIKE :4 OR T1.NAME LIKE :5 OR
      T1.NAME LIKE :6) AND UPPER(T1.NAME) = UPPER(:7))
   ORDER BY T1.NAME, T1.DESC_TEXT"
01/22/98,21:04:10,SQLBIND,1,1,1-6NF
01/22/98,21:04:10,SQLBIND,1,2,N
01/22/98,21:04:10,SQLBIND,1,3,ac%
01/22/98,21:04:10,SQLBIND,1,4,Ac%
01/22/98,21:04:10,SQLBIND,1,5,aC%
01/22/98,21:04:10,SQLBIND,1,6,AC%
01/22/98,21:04:10,SQLBIND,1,7,Account

The following examples show the use of Trace, Traceoff, and TraceOn methods to generate a trace file with SQL statements issues by the scripting query.

The following example is in Siebel eScript:

function BusComp_NewRecord ()
{
   TheApplication().TraceOn("C:\\trace_output.txt", "SQL", "");
   TheApplication().Trace("Start of tracing!");
   var oBC = this.GetPickListBusComp("Sales Stage");

   with (oBC)
   {
      SetViewMode(AllView);
      ClearToQuery();
      SetSortSpec("Sales Stage Order(ASCENDING)");
      ExecuteQuery(ForwardOnly);
      if (FirstRecord())
      {
         Pick();
      }
   }

   oBC = null;
   TheApplication().Trace("End of tracing!");
   TheApplication().TraceOff();
}

The following example is in Siebel VB:

Sub BusComp_NewRecord

   TheApplication.TraceOn "C:\trace_output.txt", "SQL", ""
   TheApplication.Trace "Start of tracing!"
   Dim oBC as BusComp
   Set oBC = Me.GetPickListBusComp("Sales Stage")

   With oBC
      .SetViewMode AllView
      .ClearToQuery
      .SetSortSpec "Sales Stage Order(ASCENDING)"
      .ExecuteQuery ForwardOnly
      If .FirstRecord Then
         .Pick
      End If
   End With

   Set oBC = Nothing
   TheApplication.Trace "End of tracing!"
   TheApplication.TraceOff
End Sub

Related Topics

Trace Method
TraceOff Method

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.