KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: A utility to turn Debug logging on and off
PRODUCT: 4D | VERSION: 14.x | PLATFORM: Mac & Win
Published On: May 20, 2016

Whereas Debug Logging can be turned on and off from the Administration window on 4D Server, there is no such option in 4D standalone.

To enable a developer turn Debug Logging on and off easily in standalone, the utility below is meant to be called from a menu while the application is in use.

The example assumes the call is coming from the "Mode" menu, but can be hooked in from any active menu bar.

If (True)
   If (False)
      Begin SQL
         /*
          Name: MENU_ToggleDebugLogging
          Path: MENU_ToggleDebugLogging

          Purpose: Toggle Debug Logging On or Off
         */
      End SQL
   End if
   C_TEXT($MethodName_T)
   $MethodName_T:=Current method name
    //===================== Declare Variables ==================================
    //method_parameters_declarations
    //-------------------------------------------------------------------------
    //method_wide_constants_declarations
    //-------------------------------------------------------------------------
    //local_variable_declarations
   C_REAL($Result_R)

End if
//====================== Initialize and Setup ================================

//======================== Method Actions ==================================

$Result_R:=Get database parameter(Debug log recording)
If ($Result_R=0)
    // Assumes using the Default menu bar #1 were Mode is Menu 3
    // Added menu items are...
    // Item # 2 is a Separator line
    // Item # 3 is Turn Debug Logging On
    // Item # 4 is Turn Debug Logging Off
    //
   SET DATABASE PARAMETER(Debug log recording;2+4) // enables file with v14 format, with parameters
   DISABLE MENU ITEM(3;3) // Debug Logging On
   ENABLE MENU ITEM(3;4) // Debug Logging Off

Else
   SET DATABASE PARAMETER(Debug log recording;0)
   DISABLE MENU ITEM(3;4) // Debug Logging Off
   ENABLE MENU ITEM(3;3) // Debug Logging On

End if

//======================== Clean up and Exit =================================