ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / Managing log processes
  • Overview
  • The different types of logs
  • Logs available in HFSQL Classic mode
  • Logs available in HFSQL Client/Server mode
  • Implementing the log process
  • Defining the log process for the data files
  • Defining the log process for the items
  • Generating the analysis
  • Automatic data modification and log process
  • The different files created when implementing the log process
  • Files created in HFSQL Classic mode
  • Files created in HFSQL Client/Server mode
  • WDLog: tool for log management
  • Handling the logs through programming
  • Two data files must not use the same log file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Implementing the log process in an application
HFSQL ClassicHFSQL Client/ServerAvailable only with these kinds of connection
Overview
Regardless of the data files used by your application (HFSQL Classic or HFSQL Client/Server), the log process can be implemented on these data files.
To implement the log process on the files of your application, you must:
  1. Define the type of log process to perform.
  2. Define the log process for the data files.
  3. Define the log process for the items.
The files created by the log process depend on the type of access to your data files (HFSQL Classic or HFSQL Client/Server).
Files with logs can be manipulated programmatically or using WDLog.
The different types of logs
WINDEVWEBDEV - Server codeWindowsHFSQL Classic

Logs available in HFSQL Classic mode

WINDEV, WEBDEV and WINDEV Mobile propose the following options to log your data files: several files are automatically created according to the selected option.
OptionAction performedFiles automatically created
No log (default option)None
Write-to-file logThe following information will be saved:
  1. All the additions, modifications and deletions performed on the current file.
  2. The value of the records handled BEFORE and AFTER the operation.
When should I choose this option?
To find out who modified the file as well as the modification that was performed.
<File Name>JNL.fic
Access historyAll operations performed on the logged files of application are saved. The value of the records used is not be saved.

When should I choose this option?
To find out the operations performed on the logged files of the application.
JournalOperation.fic
JournalIdentification.Fic
Write-to-file log + access historyThe following information will be saved:
  1. All the additions, modifications and deletions performed on the current file.
  2. The value of the records handled BEFORE and AFTER the operation.
  3. All operations performed on the logged files of application are saved.
When should I choose this option?
To find out:
  • who modified the file,
  • what modification was performed.
  • what are the operations performed on the file.
<File name>.JNL.fic
JournalOperation.fic
JournalIdentification. fic
WINDEVWEBDEV - Server codeWindowsHFSQL Client/Server

Logs available in HFSQL Client/Server mode

In Client/Server mode, WINDEV, WEBDEV and WINDEV Mobile propose the following options to log your data files: several files are automatically created according to the selected option.
OptionAction performedFiles automatically created
No log (default option)None
Write-to-file logThe following information will be saved:
  1. All the additions, modifications and deletions performed on the current file.
  2. The value of the records handled BEFORE and AFTER the operation.
<File Name>JNL.fic
JNL_FILES.fic
JNL_OPERATION.fic
JNL_USER.fic
Implementing the log process

Defining the log process for the data files

The log process on HFSQL Classic or Client/Server data files is implemented in the data model editor.
To implement the log process on a data file described in the analysis:
  1. Make a backup copy of the data files in their current status with WDLog.
  2. In the data model editor, open the description of the desired data file:
    • Select the data file in the editor.
    • Select "Description of data file" from the popup menu.
  3. In the "Miscellaneous" tab, select the type of log to manage for this data file.
  4. Depending on the selected option, specify (if necessary) the directory of the different files created by the log process.
HFSQL Classic Remarks:
  • Caution: the JournalIdentification and JournalOperation files are always found in the same directory. By default, these files are created in the directory of the application.
    This directory is defined in the analysis options: click in the background of the analysis graph and select "Analysis description" in the context menu.
    This directory can be modified for each data file.
  • Tip: the log files are used to save the operations performed on a file and to replay them on a backup if a problem occurs (unusable disk for example). We recommend that you save the log files in directories (and even disks) different from the ones used for the data files.

Defining the log process for the items

By default, all items of a logged file are automatically logged. You have the ability to define:
  • whether some items must be logged or not. For example, if one of the data files uses a memo item to store an image (information not that important and that does not change very often), you have the ability not log this item.
  • whether the logged item must be a key in the log. This option allows you to easily retrieve a record in the log.
To avoid implementing a log on an item:
  1. Display the file description.
  2. Display the description of requested item.
  3. In the "Advanced" tab, uncheck "Log item".

Generating the analysis

Once the log process was defined in the data model editor, the analysis can be generated.
Caution: Before you perform this operation, we recommend that you save the data files with WDLog.

Automatic data modification and log process

When the automatic data file modification is performed on logged data files:
  1. The log files are automatically saved.
  2. The log files are flushed.
The different files created when implementing the log process
WINDEVWEBDEV - Server codeWindowsHFSQL Classic

Files created in HFSQL Classic mode

When a log option has been requested for an analysis file, the following files can be created:
JournalOpération.FicList of all the operations performed on the logged HFSQL data files used by the application. An operation corresponds to an HFSQL function.
JournalIdentification.FicList of physical locations of all logged files found in the application
* JNL.FicFile created for each logged file. Contains the value of records used before and after each operation.

For more details, see: structure of log files.
To configure the location of these files and their password:
  • JournalOperation and JournalIdentification files: By default, these files are created in the directory of the application. To modify this directory:
    1. Display the analysis description: click in the analysis graph, open the context menu and select "Analysis description".
    2. Display the "Log" tab.
    3. Select the file directory and its password if necessary.
    Remark: This directory can also be modified for each logged file ("Description of the data file" in the context menu, "Miscellaneous" tab). In this case, the JournalOperation and JournalIdentification files will be created for each file at the specified location.
  • *JNL file: By default, this file is created in the application directory. To modify this directory:
    1. Display the file description: "Description of data file" from the popup menu.
    2. Display the "Various" tab.
    3. Select the file directory.
    Remark: The password of *JNL file will be identical to the password of data file.
WINDEVWEBDEV - Server codeWindowsHFSQL Client/Server

Files created in HFSQL Client/Server mode

When a log option has been requested for an analysis file, the following files can be created:
JNL_FILES.FicDescription of logged files.
JNL_OPERATION.FicDescription of actions performed on a logged file.
JNL_USERS.FicDescription of users who perform an action on a logged file.
*JNL.FicFile created for each logged file. Contains the value of records used before and after each operation.

For more details, see: structure of the log files in Client/Server mode.
WDLog: tool for log management
WDLog is used to:
  • Save and restore your data files
  • Check the consistency of a log and clear it if necessary
  • Restore a data file from its log.
  • Find out who modified a record, and when, ...
This tool can be freely distributed along with your applications. For more details, see WDLog.
Handling the logs through programming
The management of logs is automatically performed. However, several WLanguage functions can be used to handle the logs:
HChangeLogDirDynamically modifies the location of log files corresponding to an HFSQL file (*JNL files and JournalOperation and JournalIdentification files).
HFSQL Client/Server This function has no effect.
HHistoryModificationReturns the modifications made to one or more items of a given record.
HLogInfoAdds comments to the log when saving the logged operation. These comments can be viewed in WDLog.
HLogRecreateRe-creates an empty log. This function is used to reset a log to 0 after a backup or a replication for example. The content of the existing files is lost.
HLogRestartRestarts the log process on a file. This log process was stopped by HLogStop.
HLogStopStops the log process of a file. The operations performed in the logged file are not saved anymore.
HRegenerateFileRegenerates a file from its log.
HSetLogUsed to enable (or not) the log management. This management is enabled by default. If logs do not have to be managed in a process, call HSetLog(False). In this case, the execution of the processes will be faster.

The WLanguage properties can also be used to manage the logged files:
LogDirectoryManages the log file directory described in the analysis. You can:
  • Find out the directory of log for a file defined in the data model editor or dynamically.
  • Define the log directory for a file that was defined dynamically.
HFSQL Client/Server This property returns "." (current directory).
LogFileAllows you to find out whether a data file is a log file or not.
LogMethodIdentifies the log mode used for a data file (defined in the data model editor or dynamically).
OperationLogDirectoryUsed to manage the directory for the operation file of the log associated with a logged file. You can:
  • Find out the directory of operation log linked to a logged file defined in the data model editor or dynamically.
  • Define the log file directory for a file defined dynamically.
HFSQL Client/Server This property has no effect.
WINDEVWEBDEV - Server codeWindowsHFSQL Classic

Two data files must not use the same log file

Several cases may occur:
  • When creating a data file, the log uses the GUIDs to check whether two data files found at different locations do not use the same log file. Indeed, the data found in the log could be corrupted if the same log file is used by several data files.
    An error is displayed if the same log file is used by several files.
  • When copying or moving a data file, the GUID of this file is not modified. In this case, the HFSQL engine detects that the location of the data file was modified. A new record is automatically added into the JournalIdentification file in order to specify the new location of the data file and its GUID. However, no check is performed by the log.
    The developer should make sure that two copies of the same data file found at different locations do not use the same log file, in which case the content of the log file would not correspond to any of the two files.
  • When a data file is replaced with one of its earlier backups, the GUID is not modified. This operation is not automatically detected by the log process.
    In such situation, you must delete the JNL file at the same time as its data file and eventually restore the JNL file saved at the time as the data file.
Reminder: Two types of file GUID are supported by the HFSQL engine:
  • File GUID defined when the file was described in the data model editor. This GUID is used to manage the .REP.
  • File GUID defined when creating the physical data file. This GUID is used in the log process.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/02/2024

Send a report | Local help