Module to supply the functions necessary to create a logfile and an
associated event describing the action which took place.
The Module has to stay independent. Thus no reference to
SYSMOD routines or fields might be taken.
The purpose of this module is to enable the easy and error-free creation of process logs in transactions which are used in technical areas like reorganizations, cleanup processes or manager running in background.
The module provides the following functionality:
To display a log within other transactions, the following steps need to be taken:
Should be called in the Init to generate the default header with
The following has to be considered when implementing a processing log:
An additional type can be passed when calling. This type describes the meaning of the line or it marks the log line with a flag.
Type at WriteLine | Description |
---|---|
Empty | Normal process, pre- or post-processing line. |
LogmodInfo | Special state that is remarkable, but is not really an error. |
LogmodWarning | Error state, that can be revoked, for example, by repeating (e.g. a record is locked and the current processing can unproblematically be started again a second time) |
LogmodError | Serious error state, that needs to be handled by a system administrator. |
Property | YES/NO |
---|---|
Single page frame | Yes |
Show toolbar | Yes |
Show menu | Yes |
Show statusbar | Yes |
Show hint | Yes |
Fit panel size | Yes |
Name | Description | Data Type | Len | Dec. | View lines | View type | Inst. | Visible | Codetable |
---|---|---|---|---|---|---|---|---|---|
EVTTXT | Passed Event description | Block | 80 | 4 | 4 | Block | Yes | Private | |
MAXSIZ | Maximum size of the logfile | Numeric | 10 | 0 | Edit | Yes | Public | ||
PENLINCNT | Count of written lines after last LogCommit | Numeric | 8 | 0 | Edit | Yes | Read only | ||
LOGFIL | Filename of logfile | Text | 80 | 1 | Edit | Yes | Read only | ||
SHRLOG | Name of the shared log | Text | 20 | 1 | Edit | Yes | Read only | ||
FLGCNTI | Count of Flag Info | Numeric | 8 | 0 | Edit | Yes | Read only | ||
FLGCNTW | Count of Flag Warning | Numeric | 8 | 0 | Edit | Yes | Read only | ||
FLGCNTE | Count of Flag Error | Numeric | 8 | 0 | Edit | Yes | Read only | ||
FLGCNTO | Count of other Flags | Numeric | 8 | 0 | Edit | Yes | Read only | ||
NXTDAT | Date of next check of size | Date | 12 | 0 | Date | Yes | Private | ||
NXTTIM | Time of next check of size | Numeric | 6 | 4 | Edit | Yes | Private | ||
NXTADD | Timegap between checks | Numeric | 6 | 4 | Edit | Yes | Public | ||
SWTLST | List of all hours where a switch should occur | Text | 25 | 1 | Edit | Yes | Public | ||
LOGSUBDIR | Subdir under Partition LOG ( YYYYMM ) | Text | 6 | 1 | Edit | Yes | Public | ||
MOVERRFLG | Logfile move error | Text | 40 | 1 | Edit | Yes | Public | Embedded |
The originally passed textual description of the event.
This Text concatenated with the filename of the Logfile will be stored in the Event.
This field holds the maximum size of a logfile in bytes. If a log grows beyond this size an automatic switch to a new log will take place.
The default value preset in init of LOGMOD is 3096000 which stands for a size of 3 MB.
Name of the logfile where the logentries are written to.
The field holds the complete filepath.
The filename is generated by LOGMOD.
If the file could not be created or opened two blanks are stored in the field.
This field holds the name of the shared logfile the module is currently writing to.
This field defines the default maximum frequency of checking the filesize.
The default value of 0.01, which stands for once per minute, is set in the init of LOGMOD.
String to mark all hours with a nonspace character where a switch of the log should take place.
The first character represents midnight or 0:00, the second 1:00 and so on.
Code | Text |
---|---|
No error occurred | |
X | Error occurred when moving logfile |
Rule | Name | Additional |
---|---|---|
default | LOGDSP\LOGFIL | order 900 |
function | InternalLogPrefix | text |
function | SuspendLog | text method |
function | WriteSummary | text method |
init | ||
sub | CheckLogAutoSwitch | method |
sub | CloseLog | method |
sub | CommitLog | method |
sub | HandleInterruptTransactionZLOG | method |
sub | InternalClearEvtEntry | |
sub | InternalClearFlagCount | |
sub | InternalClearLog | |
sub | InternalCreateEvtEntry | |
sub | InternalCreateLogFile | |
sub | InternalStoreEvtData | |
sub | InternalUpdateEvtEntry | |
sub | InternalWriteLine | |
sub | LnkLeaveActionLOGMOD | method |
sub | LogModCloseLog | method |
sub | LogModStartLog | method |
sub | LogModWriteLine | method |
sub | ResumeLog | method |
sub | StartDefLog | method |
sub | StartLog | method |
sub | StartLogWithLateEvent | method |
sub | StartSharedLog | method |
sub | StartTrnLog | method |
sub | SwitchLog | method |
sub | WriteLine | method |
sub | WriteLineAndStatus | method |
Rule to automatically set the currently created log as log to be displayed
Function to build the lineprefix used to begin each line of a log.
Function to temporarily suspend an open log.
Filename of the currently used logfile is returned.
This returned filename should be used as argument to the corresponding call to ResumeLog.
The intended usage is to suspend an open log to be able to write an entry to a shared log.
In this case the sequence should be
$LogFil = LOGMOD.SuspendLog
LOGMOD.StartSharedLog( “xxx” )
LOGMOD.WriteLine( “xyz was processed” )
LOGMOD.CloseLog( “” )
LOGMOD.ResumeLog( $LogFil )
Corresponding function: ResumeLog
Function to write the summary of the currently written log.
The function returns the most severe level. The internal used sequence is:
blank → `O`ther → `I`nfo → `W`arning → `E`rror
ArgHea may be used to set the heading of the Summary. If a blank heading
is passed a default heading is used.
ArgFlg Passing a nonblank value clears the counter after output of the summary.
Corresponding functions: StartLog, StartSharedLog, WriteLine, CloseLog
Routine to check for automatic switching of the log due to size overrun or timer.
This routine might be called externally. It is internally called when writing loglines.
The following externally set fields control the switching to a new logfile:
MAXSIZ describes the maximum allowed size of a logfile. (Default: 3 MB)
SWTLST holds a list of hourmarkers for time controlled switching (Default: No time)
NXTADD describes the maximum frequency of the automatically executed checks (Default: 0.01, thus check not more often than every minute)
Corresponding functions: SwitchLog
Routine to finally update and close a log. If the counter of marked lines are set, the
Summary is automatically created with the default heading.
ArgRtn might optionally hold a returncode used to update the event created on entry.
After having used this function a DBCommit has to be issued by the calling transaction.
Corresponding functions: StartLog, StartSharedLog, WriteLine, WriteSummary
Routine to flag the current transaction as idle.
The intended usage is to call CommitLog after having complete a task when returning control to the user.
When using CommitLog at least one WriteLine should be executed before any data is amended.
After having completed the amendment and if necessary commited the amendments to the database
a call to CommitLog would flag the log as complete (up to now). Any further WriteLine would
restore the incomplete status.
On execution of an Interrupt check and optionally close a log
Routine to clear the counter per flag
Internal routine to initially clear all log fields
Internal routine to create the EVT entry.
Internal routine to create the filename of the processing log or the filename of an archive of
a shared logfile
Output is the created logfil with the filename stored in LOGFIL.
Internal routine to save the fields of the EVT into the local EVT module
Has internally to be used after creation of the logfile.
Database related fields like INR and Session-INR should be set separately.
Routine to finally update the evt entry of a log.
ArgRtn might optionally hold a returncode used to update the event created on entry.
After having used this function a DBCommit has to be issued by the calling transaction.
Corresponding functions: CloseLog
Part of the WriteLine routine to output the text into the logfile without switch checking.
Routine to finally update and close a log.
ArgRtn might optionally hold a returncode used to update the event created on entry.
After having used this function a DBCommit has to be issued by the calling transaction.
This routine is obsolete and the new routine CloseLog should be used.
Procedure to initially create a Log.
If possible an event is created holding a textual reference to the created logfile.
ArgTxt holds the text used in the event to describe the action, that will take place.
This routine is obsolete and the new routine StartLog should be used.
Inserts a Logentry / Logline into the open Log. The Log has to be started with the StartLog procedure in advance.
If the passed Text hold more than one line only the first line is prefixed by the current date and time.
The other lines are indented with space characters.
This routine is obsolete and the new routine WriteLine should be used.
Function to resume a temporarily suspended open log.
The filename returned by the preceding SuspendLog should be used as argument.
Corresponding function: SuspendLog
Open a new log and write a default header for standard transactions
Procedure to initially create a Log.
If possible an event is created holding a textual reference to the created logfile.
ArgTxt holds the text used in the event to describe the action, that will take place.
Corresponding functions: WriteLine, WriteSummary, CloseLog
Procedure to initially create a Log. The Event will be created upon closing of the
log. This is intended for routines like SYSDBA which initially create the necessary
database table.
The event is created holding a textual reference to the created logfile.
ArgTxt holds the text used in the event to describe the action, that will take place.
Corresponding functions: WriteLine, CloseLog
Procedure to initially create or extend a shared Log.
ArgLog holds the Basename of the shared log to be filled. (Default value is the Transactionname)
Corresponding functions: WriteLine, WriteSummary, CloseLog
Open a new log and write a header for standard transactions
Routine to close the current log and continue in a new logfile
ArgTxt holds an optional text describing the reason for the switch of the log, which
if set is inserted at the end of the old log.
Inserts a Logentry / Logline into the open Log. The Log has to be started with the StartLog or StartSharedLog procedure in advance.
ArgLin holds the Text to stored in the log.
If the passed Text hold more than one line only the first line is prefixed by the current date and time.
The other lines are indented with space characters.
ArgFlg holds an optional Flag to mark the severity of the entry
Corresponding functions: StartLog, StartSharedLog, WriteLineAndStatus, WriteSummary, CloseLog
Inserts a Logentry / Logline into the open log and shows the line in the statusline
The arguments are identical to the routine WriteLine.
ArgLin holds a line of text to be stored in the log.
ArgFlg holds an optional flag to mark the severity of the entry
Corresponding functions: WriteLine
Module class | Instance | Comment |
---|---|---|
LOGDSP | LOGDSP | |
EVT | EVT |