Tip — PeopleTools: Application Engine Logging Ap…

Tip — PeopleTools: Application Engine Logging

Application Engines have the ability to write to the “Redirected Terminal Output”. But, everything that is written into it must be written with a MessageBox command. That results in a blank line between messages and the infamous message set ids at the end.

If you want any formatting at all you should open a file and use the File object to create the file.

First, declare the variable in every PeopleCode program in your App Engine:

Component File &logFile;

Declare the variable as a component or global variable so that it stays around for the life of the App Engine program. Otherwise, you will have to keep reopening the file to write to it in each PeopleCode step.

Second, create an Init step in the Main section that will open the file:

&logFile = GetFile(GetEnv(“PSPRCSLOGDIR”) “\logFile.txt”, “W”, %FilePath_Absolute);

PSPRCSLOGDIR is the environment variable that is set to the path where the files should go. Every file that is put in this path will be copied to the web server so that the user can see it.

You can use %Filepath_Relative in many cases, but sometimes the relative path does not point to the proper folder, particullarly on older PeopleSoft systems. I have had more success with PSPRCSLOGDIR.

Third, close the file in a step at the end of the Main section:


Finally, write what you want to the file with:

&logFile.writeline(“This is a log statement!”);

You have complete control of this file and can make it say what you want it to.

3 Responses to “Tip — PeopleTools: Application Engine Logging Ap…”

  1. radha krishnan Says:

    can u clearly give the procedure how to create a file and load data into tht file from the database?

  2. digitaleagle Says:

    radha krishnan,

    Here is a quick version. When I get time, I will try to create a new post with more specifics.

    First, create a file layout. This will basically map the fields in the database to the structure in the file.

    Then, create an App Engine that looks something like this:

    Step 1: Open the file with a component or global variable, attach the file layout to the file (SetFileLayout)
    Step 2: Create a Do Select to select the rows, Create a PeopleCode action that runs for each row that will copy the data into the file layout rowset. Then write the row set.
    Step 3: Close the file

    Alternative: instead of using the Do Select, you could combine everything into one step and use a SQL object in PeopleCode to select the data.

    Hope that helps,


  3. Ivan Says:

    Thank you for this post! It is still applicable, we are on tools 8.52.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: