PeopleSoft Trace PeopleCode

In our previous post, we saw how to set trace options in PeopleSoft application, when logging into PeopleSoft. We added the trace flags and scanned the pages of interest to grab the trace file.

This option is good but there is another great deal of flexibility brought into this tracing, which can be enabled directly from PeopleCode. This is done using two built in functions offered by PeopleSoft. They are SetTracePC and SetTraceSQL. You can conditionally add these trace options in the code location which you want to trace, and then the trace will be written to the LOGS directory location when that PeopleCode section is invoked.

PeopleBooks documents numerous options for SetTracePC, which takes a number as an argument. A value of 0 indicates that the tracing can be stopped. An acceptable non-zero value would dump the relevant trace information based on the value passed to SetTracePC. An example for using SetTracePC to set up PeopleCode trace is shown below
SetTracePC(384);
/* REM PeopleCode Statements to be traced */
Local string &St_temp_l;
/* More PeopleCode statements */
SetTracePC(0);
When this PeopleCode location is accessed, the SetTracePC will write the trace information to a trace file in the LOGS directory (assuming that this is done via application server). When SetTracePC is used in an Application engine program, then the trace file will be written to the process scheduler LOGS directory.

While SetTracePC allows to trace PeopleCode programatically, SetTraceSQL does the same thing but it traces SQL information programatically. The file generated out of SetTraceSQL shows the SQLs executed by PeopleTools when it executes any code. The trace options for SetTracePC and SetTraceSQL are well documented in PeopleBooks. You can refer to the PeopleCode Language Reference Peoplebook for more information.

1 comment:

  1. Good post. I'm facing many of these issues as well..

    ReplyDelete