This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
START MONITORING ACTIVITY
|
START MONITORING ACTIVITY ( duration {; source} ) | ||||||||
Parameter | Type | Description | ||||||
duration | Real |
![]() |
Length of time (in seconds) before logging begins | |||||
source | Longint |
![]() |
Origin of an operation | |||||
The START MONITORING ACTIVITY command records operations exceeding a specified duration in memory. It can be called and executed on 4D remote, 4D Server, and 4D standalone applications (if source isn't from network activity). Recorded activity can be retrieved using the Get Monitored Activity command. Call STOP MONITORING ACTIVITY when you want to stop tracking activity.
In the duration parameter, pass a number defining a length of time before loggin begins (in seconds, can be expressed as a decimal) for an operation's execution. Once an operation's execution exceeds the duration, the operation will be recorded in memory.
The optional source parameter defines the kind of activity to monitor. Possible values:
Constant | Value | Comment |
Activity all | -1 | Activity from all sources (default value) |
Activity language | 1 | Language execution operations |
Activity network | 2 | Network request operations |
Activity operations | 4 | 4D data operations |
Note: If the debug logs have been stopped on the 4D Server GRAPH SETTINGS, START MONITORING ACTIVITY with Activity network will restart the logs.
You want to start/stop monitoring and review 4D data and debug activities lasting longer than a millisecond:
C_COLLECTION($activities)
START MONITORING ACTIVITY(0.001;Activity operations+Activity language)
$coll:=ds.Persons.all().toCollection("firstname, lastname, address.*")
//return all operations over 1 millisecond from the 4D data activity and the debug log
$activities:=Get Monitored Activity
$text:=JSON Stringify($activities.orderBy("startTime");*)
TEXT TO DOCUMENT("result.txt";$text)
//end monitoring for 4D data activity and from the debug log
STOP MONITORING ACTIVITY()
result.txt:
[
{
"activityKind": 4,
"activityDuration": 0.005,
"activityData": {
"message": "Exporting selection of entities in Persons as a collection: 400 of 401 entities",
"maxValue": 401,
"currentValue": 400,
"interruptible": true,
"remote": false,
"uuid": "4ED341FCF8BF40649C9A827EF794A688",
"taskId": -5,
"startTime": "2020-02-28 13:20:00:010",
"duration": 5,
"title": "Entities To Collection"
}
},
{
"activityKind": 1,
"activityDuration": 0.005,
"activityData": {
"sequenceNumber": 2514,
"elapsedTime": 5,
"processID": 7,
"uniqueProcessID": 14,
"stackLevel": 0,
"duration": 5056,
"kind": "Member",
"parameters": "firstname, lastname, address.*",
"functionName": "toCollection"
}
}
]
Product: 4D
Theme: Tools
Number:
1712
Created: 4D v18 R3
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)