Home > PeopleCode > Log file in Application Engine

Log file in Application Engine

September 15, 2008 Leave a comment Go to comments

A typical example of Log file creation in application engine using peoplecode is given below.

local File &Log_file;

&Log_file = GetFile(“c:\temp\logfilename.txt”, “W”, %FilePath_Absolute);

&Log_file.WriteLine(“Begin Process : ” | %Datetime);

&Log_file.close()

But if you have to use the same log file across the sections within an application engine, then
Declare the file as global in one of the initial step as given below.

Global File &Log_file;

&Log_file = GetFile(“c:\temp\logfilename.txt”, “W”, %FilePath_Absolute);
&Log_file.WriteLine(“Begin Process : ” | %Datetime);

Then in any following section’s peoplecode step, declare the global variable and start writing to the file.

Global File &Log_file;

&Log_file.WriteLine(“Write anything here”);

Don’t forget to close the log file at the end of application engine.

Global File &Log_file;

&Log_file.close()

Advertisements
  1. Aravind_ram
    March 12, 2009 at 11:30 am

    This is good for simple stats like start date time etc.
    How would you go about when the requirement is to log stats at the end of the process such as, no of rows updated, no of rows inserted etc?

  2. balaglobal
    March 12, 2009 at 12:07 pm

    keep a global variable counter, whenever you are updating or inserting the rows add one to the counter.At the end of the process write this counter to the log file.

  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: