SetErrorLog Function (Logic) | |
Return and optionally change the setting that determines whether error information is written to the error log file by the default runtime error handler.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SetErrorLog(
lNewSetting AS LOGIC
) AS LOGIC
public static bool SetErrorLog(
bool lNewSetting
)
Request Example
View SourceParameters
- lNewSetting
- Type: Logic
TRUE causes error information to be written to a text file, known as a X# error log file. FALSE suppresses the recording of errors in the error log file.
If the ErrorLog entry in the X# section of WIN.INI is not present, an entry of ErrorLog=1 will be written, setting the initial default to TRUE; if this entry is set to 0, the initial default is FALSE.
Return Value
Type:
Logic
If
lNewSetting is not specified, SetErrorLog() returns the current setting.
If
lNewSetting is specified, the previous setting is returned.
Remarks
SetErrorLog() gives you a way to keep track of errors that occur in an application at runtime.
If it is set to TRUE and your application generates one or more errors when executed, the default error handler writes error information to an error log file named VOERROR.LOG.
If the ErrorLogAppend entry in the X# section of WIN.INI is not present, an entry of ErrorLogAppend=0 will be written, causing the error log file to be created anew for each application run.
If this entry is set to 1, the error information is appended to the existing error log file.
This feature is useful if there are multiple applications running simultaneously on the same computer. In either case, the error log file is created if it does not exist.
The location of the error log file is controlled by SetDefaultDir(), which you can refer to for more information.
Although writing error information to a file is normally useful, in some situations (such as when you are limited by network create rights, the maximum number of open files, shortage of disk space, or insufficient directory entries) you must use SetErrorLog() to prevent the system from writing to an error file.
Examples
This example sets SetErrorLog() to FALSE and saves the previous setting:
1lSaveErrorLog := SetErrorLog(FALSE)
2MyFunc()
3SetErrorLog(lSaveErrorLog)
See Also