KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: SET DATABASE PARAMETER (34) Debug Log files
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: May 7, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When using SET DATABASE PARAMETER(34) to generate a Debug Log, the files created are placed in the Logs folder of the database. The files have the following format: 4DDebugLog_X.txt. X is a sequential number added to the file name starting with 1.

The following rules apply:

  1. When the file reaches 10MB in size, the file is closed and a new file is created with the next number in the sequence.
  2. If a file with the same name exists, it gets replaced immediately.
  3. When the application is relaunched, and SET DATABASE PARAMETER (34) is still recording, the file 4DDebugLog_1.txt (if it exists) gets rewritten immediately. If other files exists in the Logs folder (4DDebugLog_2.txt, 4DDebugLog_3.txt, etc.) they remain with the same Debug Log information of the previous session, unless they are required. In that case the file gets replaced.


To avoid confusion, before launching the application if Debug Log files exist in the Logs folder, copy them to another folder for further analysis.

Commented by Justin Leavens on January 14, 2011 at 12:12 PM
What is the keystroke for the 4D Server to immediately enable debug log recording, and which mode does it enable?
Commented by Timothy Penner on May 27, 2009 at 1:58 PM
Mehboob, to answer your question the setting does not stick between relaunches.

The debug log recording only starts when the SET DATABASE PARAMETER is issued with selector 34 and a second parameter of either 1 or 2. However, if you put the SET DATABASE PARAMETER in your ON STARTUP method then yes it will start automatically (when the ON STARTUP method executes). You should be able implement some log rolling code in your ON STARTUP method before issuing the SET DATABASE PARAMETER command.
Commented by Mehboob Alam on May 18, 2009 at 2:13 PM
> To avoid confusion, before launching the application if Debug Log files exist in the Logs folder, copy them to another folder for further analysis.

This is difficult to do if the Server is running as a Service, and is set to auto-restart the service after a crash.

Is this option "sticky"? i.e. when the Server starts up, does the database start recording based on the last set option for SET DATABASE PARAMETER?

It would be much more useful if the default is to NOT record, and you have to execute SET DATABASE PARAMETER explicitly to start recording. That would give the developer the opportunity to detect that there are debug files, and perform a custom "log-rolling" function to move/rename them and prevent them being overwritten.
Commented by Mehboob Alam on May 18, 2009 at 2:08 PM
Correction: 0 - stop recording?
Commented by Atanas Atanassov on May 8, 2009 at 1:51 PM
SET DATABASE PARAMETER command have a second argument. For selector 34 options are 0 - stop recording, 1 - record and 2 - record in detailed mode. The syntax for turning on debug log file in detail recording mode will be; SET DATABASE PARAMETER(34;2)