Tech Tip: SET DATABASE PARAMETER (34) Debug Log files
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: May 7, 2009
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:
- When the file reaches 10MB in size, the file is closed and a new file is created with the next number in the sequence.
- If a file with the same name exists, it gets replaced immediately.
- 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.
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.
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.