WRITE LOG


General Form:

WRITE LOG [level,] message
Where:

level=An integer ranging from 0 to 2
message=An alpha expression containing the information to be written to the log

This statement is used to write messages into the system log (syslog) file if operating under UNIX or the application event log if operating under NT.

Messages are written into the log using three different levels. These are:

KCML constantLevelPurposeUnix level code
_LOG_INFORMATION0x00Information messageLOG_INFO
_LOG_WARNING0x01Warning messageLOG_WARNING
_LOG_ERROR0x02Error messageLOG_ERR

If no warning level is specified then a level of 0 (Information) is assumed.

Byte 52 of $OPTIONS RUN sets a threshold that can be used to filter out specific warning levels, for example setting this byte to HEX(02) would mean that only WRITE LOG statements that specify a level of 2 will be executed. Setting it to HEX(FF) will disable logging. The default is HEX(00) to allow all WRITE LOG events.

On Unix systems it may be necessary to configure the syslog daemon to accept messages. For KCML 6+ WRITE LOG uses the facility code LOG_LOCAL1 while KCML 5.02 uses the LOG_USER facility code.

Under Windows NT based operating systems (NT4, Win2000, XP, 2003 Server etc) WRITE LOG messages will be written to the Application Event Log. The messages can be inspected using the eventvwr.exe utility.

On Windows 95 and Windows 98, where there is no operating system log, these log messages can be written to a nominated text file by setting a registry entry using kservadm. There are two values under the following key

HKEY_LOCAL_MACHINE\Software\Kerridge\EventLogging

The STRING value LogFile defines the filename and the DWORD value Enabled is a boolean flag turning logging on (0x01) or off (0x00). This key is ignored on NT.

Syntax examples:

WRITE LOG _LOG_WARNING, Message$
WRITE LOG Information$

See also:

CLOSE, SEEK, READ, OPEN, $OPTIONS #