Controller.ErrorLog Property

Returns an entry from the system Error Log as a String value or clears the Error Log.

Controller.ErrorLog = <value>
-or-
... Controller.ErrorLog( entry)

Prerequisites

None

Parameters

entry

A required numeric expression that specifies the Integer number of the Error Log entry to be returned.  This value can range from 1 to n, where 1 indicates that the most recent entry should be returned.

Remarks

Whenever a runtime error occurs in the system, the error is time stamped and entered into the system Error Log.  These errors can be generated by an executing thread or from the motion control system.  In addition, GPL applications can enter items into the log using the Controller.SystemMessage method.

The entries in the Error Log are displayed on the web based Operator Control Panel and can be retrieved from the console interface.

This method permits GPL programs to retrieve entries from the Error Log one at a time.  Each returned value contains the time stamp, marker indicating the thread that generated the error, the numeric error code and the text error message.  A example of a typical returned value is as follows:

04-09-2007 12:27:14.223, Trj, -1611, "*Auto/Manual switch set to Manual*"

If you request an entry that does not exist, an empty string value is returned.  Also, if a new entry is added to the log or the log is cleared as you are scanning through the log, you may get an inconsistent set of error entries.

If this property is assigned a non-zero value as indicated above, rather than retrieving an entry, all entries are deleted from the Error Log.

Examples

Dim err As String
Dim ii As Integer
For ii = 1 To 100
err = Controller.ErrorLog(ii) ' Retrieve all entries from log
If (err <> "") Then
Console.WriteLine(err) ' Display all errors
Else
Exit For
' No more entries in the log
End If
Next
Controller.ErrorLog
= 1 ' Clear all entries in the log

See Also

Controller Class | Controller.SystemMessage