Suppress Logs in Loop - New Trace in 8.57


New in PeopleTools 8.57 is a trace flag you're going to wonder how you ever managed without. (and before you ask...no... this is not an April Fools joke .  This really is a new feature in 8.57.)

Suppress Logs in Loop - It does exactly what it says it does.  It suppresses trace output for PeopleCode loops.

How does it work?

Here's some sample PeopleCode designed to show the new trace flag behaviour.
For &i = 1 To 100
   &a = &a + 1;

   For &j = 1 To 10
      &b = &b + 1;
   End-For;
   
End-For;

WinMessage(&a | ", " | &b);

With the the Suppress logs in loop flag OFF we get 3,409 lines of trace file showing 100 iterations of the first loop and 1,000 iterations of the second loop.


With the Suppress logs in loop flag ON we get a much more readable trace file.

But how useful is this?  Well, to get a quick, easy to read picture of a complex set of functions or class method calls that are nested in a set of crazy loops then this is VERY helpful.  But what if we're troubleshooting a behaviour issue? Let's modify our PeopleCode to include a test in the outer loop which will only evaluate TRUE once.
For &i = 1 To 100
   &a = &a + 1;
   
   If &a = 2 Then
      &s = "&a has reached the 2nd iteration " | &a;
   End-If;
   
   For &j = 1 To 10
      &b = &b + 1;
   End-For;
   
End-For;

WinMessage(&a | ", " | &b | ", " | &s);

With the Suppress logs in loop flag ON we get an incomplete trace.  Clearly, our code which sets &s is executing but we can't see it in the trace below.

The reason for this is that the trace only logs the first iteration.  It's by design.  Imagine how complex it would be for the trace engine to retrospectively include trace if a condition evaluated differently from one iteration to the next.



Despite this.... I still think this is a very useful feature... and so.... thank you PeopleTools team.

Read more here  in PeopleTools Online https://docs.oracle.com/cd/F13640_01/pt857pbr2/eng/pt/tsvt/task_ConfiguringPeopleCodeTrace-0710ed.html#ContentsNavBar

Comments