The dataStore.startRequestLog( ) method starts the logging of ORDA requests on the client side.
This method must be called on a remote 4D, otherwise it does nothing. It is designed for debugging purposes in client/server configurations.
The ORDA request log can be sent to a file or to memory, depending on the parameter passed to the method:
- If you passed file object created with the File command, the log data is written in this file as a collection of objects (JSON format). Each object represents a request.
If the file does not already exist, it is created. Otherwise if the file already exists, the new log data is appended to it.
If dataStore.startRequestLog( ) is called with a file while a logging was previously started in memory, the memory log is stopped and emptied.
Note: A ] character must be manually appended at the end of the file to perform a JSON validation
- If you passed a number in the reqNum (longint) parameter, the log in memory is emptied (if any) and a new log is initialized. It will keep reqNum requests in memory until the number is reached, in which case the oldest entries are emptied (FIFO stack).
If dataStore.startRequestLog( ) is called with a reqNum while a logging was previously started in a file, the file logging is stopped.
- If you did not pass any parameter, the log is started in memory. If dataStore.startRequestLog( ) was previously called with a reqNum (before a stopRequestLog( )), the log data is stacked in memory until the next time the log is emptied or stopRequestLog() is called.
For a description of the ORDA request log format, please refer to the ORDA client requests section.
You want to log ORDA client requests in a file and use the log sequence number:
C_OBJECT($e;$file)
$file:=File("/LOGS/ORDARequests.txt")
SET DATABASE PARAMETER(Client Log Recording;1)
ds.startRequestLog($file)
$e:=ds.Persons.get(30001)
ds.stopRequestLog()
SET DATABASE PARAMETER(Client Log Recording;0)
You want to log ORDA client requests in memory:
C_OBJECT($es)
C_COLLECTION($log)
ds.startRequestLog(3)
$es:=ds.Persons.query("name=:1";"Marie")
$es:=ds.Persons.query("name IN :1";New collection("Marie"))
$es:=ds.Persons.query("name=:1";"So@")
$log:=ds.getRequestLog()
ALERT("The longest request lasted: "+String($log.max("duration"))+" ms")