This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
dataStore.startRequestLog( )

dataStore.startRequestLog( ) 


 

dataStore.startRequestLog ( {file | reqNum} ) 
Parameter Type   Description
file | reqNum  Object, Longint in File object or
Number of requests to keep in memory

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") //logs folder
 
 SET DATABASE PARAMETER(Client Log Recording;1) //to trigger the global log sequence number
 ds.startRequestLog($file)
 $e:=ds.Persons.get(30001) //send a request
 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) //keep 3 requests in memory
 
 $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")



See also 

dataStore.getRequestLog( )
dataStore.stopRequestLog( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - DataStore

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R6

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)