startlog()

Initializes error logging and opens the error log file passed as the parameter.

Syntax

startlog(
   filename STRING )
  1. filename is the name of the error log file.

Usage

Call startlog() in the MAIN program block to open or create an error log file. After startlog() has been invoked, a record of every subsequent error that occurs during the program execution is written in the error log file.

The format of the error records appended to the error log file after each subsequent error is as follows:

Date: 03/06/99 Time: 12:20:20 
Program error at "stock_one.4gl", line number 89. 
SQL statement error number -239. 
Could not insert new row - duplicate value in a UNIQUE INDEX column. 
SYSTEM error number -100 
ISAM error: duplicate value for a record with unique key.

To report specific application errors, use the errorlog() function to make an entry in the error log file.

If the argument of startlog() is not the name of an existing file, startlog() creates a new one. If the file already exists, startlog() opens it and positions the file pointer so that subsequent error messages can be appended to this file.

Example

CALL startlog("/var/myapp/logs/error-" || fgl_getpid() || ".log")
...
CALL errorlog("The current user is not allowed to perform order validation")