Writes an event into the log of Windows events.
Remark: This function is ignored if it is not called in a "Windows Service" application.
// Attempt to connect to the server of the database
IF ErrorOccurred = True THEN
ServiceWriteEventLog("Error detected while connecting to the database" + ...
CR + ErrorInfo(), elError)
ServiceWriteEventLog(<Message> [, <Type of event> [, <Event Identifier>]])
<Message>: Character string
Description of the event. This text can be re-read from the event observer by displaying the details of the event.
<Type of event>: Optional Integer constant
Type of event that will be written into the Windows log:
Signals an error while running a service. Services do not have the mean to display information: therefore, this is the main method for reporting an error.
Indicates the status of service. For example: change of activity mode, startup, ...
Indicates that a non fatal error occurred while running the service. For example: an operation was successfully performed but no notification message was sent.
<Event Identifier>: Optional integer
Event identifier (found between 1 and 100).
Tip: Use a different value for each event of the service in order to easily differentiate among them.
This value can be retrieved by the applications that read the event log in order to trigger actions.
- Events generated by ServiceWriteEventLog are written to the "Application" log of the operating system.
- The log can be re-read:
- by using the event observer (found among the management tools of Windows).
- through programming (by using the "WD EventLog" component provided with WINDEV for example).