PeopleCode Debug a 2-tier Application Engine Process - PeopleCode Friday #6

This is not really a PeopleCode tip but rather a tip to debug PeopleCode in an Application Engine process.

I had forgotten you could do this until recently I needed to step through some code in an AE and be able to examine buffer and variable state as I went.

For PIA debugging you need the debug service and the WSL setup on the Application Server and then connect Application Designer in 3-tier mode.  My recommendation is to set this up long before you need it!  This mode, however, is only useful for debugging online PIA sessions and not Application Engine process running on the batch server.

If you can run your AE process in Application Designer then you can use this technique to step through each Section, Step and PeopleCode statement.

Just a few tips

  • Create a run control called "RUN01".  This will make life easier if you're repeatedly running the same AE during development or testing as RUN01 is the default.
  • You can enable SQL and PeopleCode trace in Configuration Manager.  This will send trace output of the actual SQL being executed and you can open this file during debugging. Very useful.
  • Don't forget to use Step Over (F10) for avoiding getting bogged down in lots of function or method code.
  • Don't use Output Log to File when you run as it will repeatedly send prompts for user interaction to the log file until your local disk is full !!!! 

Step 1 -  Setup Config Manager

In Configuration Manager > Profile > Edit > Process Scheduler > Application Engine tick the Debug option.

Step 2 - Open the Application Engine

Step 3 - Open PeopleCode section and Enable Debug

Step 4 - Set Breakpoints in PeopleCode

Step 5 - Run the App Engine process

Step 6 - Use the AE process window

Step 7 - Step through PeopleCode

Watch the whole thing here...


Pete Hennessy said…
Thanks Graham,

Good instructions! and it will be useful, I'm sure, when I'm in my next development with an App Engine.

By the way - do you know if it is possible to sort the Local Variables? I can understand why they are in the order that they are declared, but it's not always helpful.

Dan said…
It is unnecessary to run AE debug and peoplecode debug at the same time, and I rarely do it.
Graham said…
@Daniel: Thanks Daniel. It's true that you don't NEED to set the AE Debug flag in Configuration Manager but I often find that when I do need to step through PeopleCode action in an AE process that I also need to step through other AE Steps too.