To create a non-shared (or private) log within a transaction, the following steps are to be taken:
Integrate LOGMOD into an appropriate module or into the transaction
Implement a call to LOGMOD.StartLog with a text describing the performed action (normally in an Init rule).
Implement a call to LOGMOD.WriteLine for every transaction step to be logged. Please keep in mind to include all necessary information in order to clearly identify the step and the results of the step. Thus, used data like file paths, counts and error codes should be included into the log entries to clearly identify the real context.
If there are certain entries you want to mark as info, warning or error use the second argument of WriteLine with one of the symbolic constants LogmodInfo, LogmodWarning or LogmodError to mark this entries. There will be an automatically created summary with the different logged severity levels and the number of occurrences at the end of the log, or earlier, if LOGMOD.WriteSummary is executed.
Implement a call to LOGMOD.CloseLog( “” ) within the normal exit of the transaction and include a DbCommit afterwards to commit the Database update.
For abnormal exits of the transaction you might include a separate call to LOGMOD.CloseLog with the returncode to be placed in the associated EVT entry.
As the module LOGDSP is included into LOGMOD, all features of LOGDSP might be used to show the currently created log instantly, even if it has not yet been closed. Normally the Button LOGMOD\LOGDSP\BUTDSP is integrated on the panel and enables the direct access to the currently created log.
To create or extend a shared log within a manager the integration slightly differs:
Instead of StartLog, the routine StartSharedLog has to be used to start the log. This routine has to get the name of the shared log instead of the event text.
(Example: LOGMOD.StartSharedLog( Basename( ININAM ) )
On shared logs no event is created
No DbCommit is needed after the CloseLog, as no Event has to be written
The argument passed on CloseLog is ignored in shared logs
The switching of the shared log should be defined in the field SWTLST, if the switching of the logs is not organized otherwise. Usually the first character of the field should be set to a nonblank value to mark midnight as switching time.
In transactions using LOGMOD, only the button BUTDSP has to be placed on a panel, in order to display the currently created log.
To display a log within other transactions, the following steps need to be taken:
Integrate LOGDSP into an appropriate module or into the transaction.
The file name of the selected log might be extracted out of an event text via a call to GetLogFilepath.
The file name of the log to be shown has to be made available to LOGDSP in the field LOGFIL.
A more descriptive name of the log used as heading to the popup panel might be put into the field LOGNAM. LOGDSP itself defaults LOGNAM to the file name of the log.