KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using Get 4D file command to list all log files in database
PRODUCT: 4D | VERSION: 16R6 | PLATFORM: Mac & Win
Published On: February 22, 2018

Here is utility method that will use the Get 4D file command to display all the log files in a database:

// ----------------------------------------------------------------------
// Name: LIST_LOG_FILES_IN_DB
// Description: Method will return an array of Log files found with Get 4D file
//
// Parameters:
// $1 (POINTER) - Array pointer to the Log file name
// $2 (POINTER) - Array pointer to the Log file path
// ----------------------------------------------------------------------
C_POINTER($1;$arrLogName)
C_POINTER($2;$arrLoc)
C_TEXT($path)
C_LONGINT($i)
C_OBJECT($obj)

If (Count parameters=2)
    $arrLogName:=$1
    $arrLoc:=$2
   
    OB SET($obj;"1";"Backup configuration file";"13";"Backup log file";"14";"Build      application log file";"6";"compacting log file";"12";"Debug log file";\
     "11";"Diagnostic log file";"9";"HTTP debug log file";"2";"Last backup file";\
     "7";"Repair log file";"10";"Request log file";"3";"User settings file";"4";\
     "User settings file";"5";"Verification log file";"8";"Web request log file")
   
    For ($i;1;14)
     $path:=Get 4D file($i)
     If ($path#"")
       APPEND TO ARRAY($arrLogName->;OB Get($obj;String($i)))
       APPEND TO ARRAY($arrLoc->;$path)
     End if
    End for
End if


Here is an example of using the method:

ARRAY TEXT($arrLogName;0)
ARRAY TEXT($arrLogPath;0)

LIST_LOG_FILES_IN_DB (->$arrLogName;->$arrLogPath)