4D Blog

Home Product Better debug logs with these improvements

Better debug logs with these improvements

June 4, 2019

Product

As a 4D developer, you may have already activated the debug log to troubleshoot problems. 4D v17 R5 introduces several improvements to help you analyze these files, such as logging only the current process and logging calls to member methods (collection or object methods).

New selector for process logging

The SET DATABASE PARAMETER command now accepts a new selector, Current process debug log recording. Called from any part of a process, it will start logging just for the current process and create a “4DDebugLog_pX_Y.txt” file in the 4D logs folder (where X is the process PUID and Y the sequence file number). Of course, you can also get the process debug log state using this new selector with the Get database parameter command.

SET DATABASE PARAMETER(Current process debug log recording;2+4+8)

You can continue to use the Debug log recording selector to record logs of the activity of all processes, excluding the processes logged by Current process debug log recording.

Reminder: you can easily access the debug logs using this line of code:

SHOW ON DISK(Get 4D folder(Logs folder))

In the screenshot below, you can see the logs generated by five processes:

Keep in mind that since the SET DATABASE PARAMETER is not thread safe, the process will start in cooperative mode.

member METHODS logging

By default, the debug logs now include calls to member methods. They’re logged with command type number 9. If you don’t want the member methods included, just call the SET DATABASE PARAMETER command and the Debug log recording or Current process debug log recording selectors with a new option which has the value 32. You still can combine the options to obtain the debug logs you want.

This example shows how to log the WiFi and Ethernet interfaces in separate collections:

SET DATABASE PARAMETER(Current process debug log recording;2+4+8)
C_COLLECTION($_networkInterfaces;$_ethernet;$_wifi)
$_networkInterfaces:=Get system info.networkInterfaces
$_ethernet:=$_networkInterfaces.query("type = :1";"ethernet")
$_wifi:=$_networkInterfaces.query("type = :1";"wifi")
SET DATABASE PARAMETER(Current process debug log recording;0)

The code returns: 

blank

More security

Previously when launching logs, files were generated until there was no more disk space available. To avoid errors or accidental activation on the 4D Server Administration Window – which could be dangerous – the number of generated files is limited to 50 by default. You can modify this limit via the SET DATABASE PARAMETER command and the Circular log limitation selector.

// Limit the number of logs files to 100 (the default number is set to 50)
SET DATABASE PARAMETER(Circular log limitation;100)

Discuss

Tags Logs, v17 R5, v18

Latest related posts

  • April 29, 2025

    Discover your AI-powered writing assistant in 4D Write Pro

  • April 28, 2025

    Unlock the Power of AI with 4D AIKit: Automate, Create, and Innovate

  • April 25, 2025

    Formulas in Label Wizard

Avatar
Damien Fuzeau
• Product Owner •Damien Fuzeau has joined the 4D Product team in February 2019. As a Product Owner, he is in charge of writing user stories, then translating them to functional specifications. His job also entails making sure that the feature implementations delivered are meeting the customer needs.Damien is graduated from the University of Nantes in software engineering. He spent more than 23 years in its former company, first as developer (discovering 4D in 1997), and later as engineering manager and software architect. This company is a 4D OEM partner and deployed 4D based business softwares for thousands users, on hundreds servers. So, Damien is used to 4D development and deployment in a multi-language context.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 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-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 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