Monitor 4D Server activity with this new tool

Many features have been released to help you manage your 4D Server activity. 4D v18 R3 provides 4D administrators another monitoring tool for 4D Server activity. A tool to get all operations executing beyond a specified time, as well as relevant details about the involved tables, fields, and clients.
This feature not only makes all the above is possible, it also makes it easier to optimize your code, identify problems, and liberate your 4D Server resources.

HDI: Monitor your 4D application activity

4D introduces a new set of commands to monitor your 4D application. They allow you to record activity (in memory) lasting more than a given time limit.

You can specify the kind of activity you want to monitor:

  • 4D data activity: operations involving the 4D data itself,
  • Network activity: you’ll get the same information as in the 4DRequestsLog file (*),
  • Language execution: you’ll get the same information as in the 4DDebugLog file (*).

(*) There’s no need to activate the corresponding log files, so no space on the disk is used.


The START MONITORING ACTIVITY command takes the duration threshold and the type of operations to monitor as parameters. For this, the following new constants can be used to monitor:

  • Activity operations: operations in the 4D data
  • Activity network: operations of the network activity
  • Activity language: operations of the language execution

Get Monitored Activity  command

When you want to get all the recorded activity, just call the new Get Monitored Activity() command! 

It returns a collection of objects with the relevant information that you can use as you wish (generate a file, display an interface for the administrator, etc.).


When you want to stop recording your 4D application activity or to empty the memory, just call the STOP MONITORING ACTIVITY command.

concrete EXAMPLE

In most cases, your need will be:

Every 10 minutes, I want to check if some operations have lasted more than 10 seconds on my 4D Server. If yes, I want to send an email to the administrator (or take another action).

The following is some code to do just that.

ON server startup method

// Detect 4D data operations which lasted more than 10s
START MONITORING ACTIVITY(10;Activity operations)
//Run a monitoring process 
:=New process("monitorOperations";0;"Monitor operations")

monitoring process (to be run on the server)

While(Not(Process aborted))
// Inspect 4D data activity every 10 minutes
DELAY PROCESS(Current process;36000)
// Get the long operations and exclude backup operations

$activities:=Get Monitored Activity().query("Not(activityData.message IN :1)";New collection("@backup@"))
  If ($activities.length#0)
   // Send an email to the administrator with $activities details
   // Empty the memory and restart the monitoring
   START MONITORING ACTIVITY(10;Activity operations)
  End if
End while

on server shutdown method

$activities:=Get Monitored Activity().query("Not(activityData.message IN :1)";New collection("@backup@"))
  If ($activities.length#0)
   // Send an email to the administrator with $activities details
  End if

Check out the HDI to learn more!
• Product Owner • Marie-Sophie Landrieu-Yvert has joined the 4D Product team as a Product Owner in 2017. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Marie-Sophie graduated from the ESIGELEC Engineering School and began her career as an engineer at IBM in 1995. She participated on various projects (maintenance or build projects) and worked as a Cobol developer. Then she worked as an UML designer and Java developer. Lately her main roles were analyzing and writing functional requirements, coordinate business and development teams.