KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: New log file Numbers Explained
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: October 14, 2024

The command New log file is used to archive the current log file (journal file) and create a new one. This is typically useful for mirroring or maintaining the size of the current log file. When the log file is archived, it is renamed with a specific format that contains two numbers.

The documentation for the command explains that the naming format is:
DatabaseName[BackupNum-LogBackupNum].journal

The BackupNum is based on the current Backup Number with 0 being no backup detected. The backup number is stored in the backupHistory.json file stored next to the database structure. The "backupNumber" property of the last backup found in the backupHistory.json file will be applied on startup. The nubmer is updated when a new backup is performed, but modifying the backupHistory.json will not change the BackupNum of the name unless a restart is performed.

The example from the documentation:
If the MyDatabase.4DD database has been saved 4 times, the last backup file will be named MyDatabase[0004].4BK. The name of the first “segment” of the log file will therefore be MyDatabase[0004-0001].journal.

The LogBackupNum is stored as part of the datafile itself. This number is the number of times the New log file has been called since the last backup the datafile has experienced. This means that even if the Backup Number is modified through the backupHistory.json file, the LogBackupNum will not reset since the datafile did not experience a backup and continue from its current state until a backup is performed.

The example from the documentation:
If the MyDatabase.4DD database has been saved 3 times and the log file has been saved 5 times since, the name of the 6th backup of the log file will be MyDatabase[0003-0006].journal.