4D Blog

Home Product Monitor 4D Server activity with this new tool

Monitor 4D Server activity with this new tool

May 27, 2020

Product
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.

START MONITORING ACTIVITY command

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.).

STOP MONITORING ACTIVITY command

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

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

monitoring process (to be run on the server)

C_COLLECTION($activities)
 
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
   STOP MONITORING ACTIVITY
   START MONITORING ACTIVITY(10;Activity operations)
  End if
 
End while

on server shutdown method


C_COLLECTION
($activities)
 
$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!
 
Discuss

Tags 4D server, Administration, v18 R3, v19

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Avatar
Marie-Sophie Landrieu-Yvert
- Product Owner - Marie-Sophie Landrieu-Yvert joined the 4D Product team as a Product Owner in 2017. In this role, she is responsible for writing user stories and translating them into functional specifications. She also ensures that the delivered feature implementation meets the customer's needs. Marie-Sophie graduated from the engineering school ESIGELEC and began her career as an engineer at IBM in 1995. She took part in various projects (maintenance and development projects) and worked as a COBOL developer. She then moved on to work as a UML designer and Java developer. More recently, her main responsibilities included analyzing and writing functional requirements, and coordinating business and development teams.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy