APGen Documentation Previous Topic: Log.Flags Next Topic: Log.LogEvent() Parent Topic: Log Object    Log Object
Log.Write()
See Also:

The Log.Write() method writes an entry to the log file.

Syntax

VBScript:

Log.Write strText [, severity] [, lngCode]

JScript:

Log.Write( strText [, severity] [, lngCode] );

Object

Log The Log object.

Parameters

strText Text to be written in the log file entry.
severity Optional. An ApgLogSeverityEnum value. The default value is apgSeverityInfo.
lngCode Optional. A long integer value to be written with the log file entry. The default value is zero.

Notes

Log.Write() writes an entry to the log file specified by Log.Path.  The log file is a comma-separated value text file, with fields time, severity, code, and text for each log entry.

APGen internally calls Log.Write() when fatal errors, errors, and warnings occur.  You may use any of the severity values when calling Log.Write() in script.

The Log.Flags property allows you to filter which Log.Write() calls are written to the log file.  The default value for Log.Flags is apgLogDefault, which lets all Log.Write() calls write to the log file.  Setting Log.Flags to apgLogNothing prevents any Log.Write() calls from writing to the log file.  The following table lists which Log.Write()  calls are filtered by which Log.Flags flags.

Log.Write Severity Filtered by this Log flag
apgSeverityInfo apgLogInfo
apgSeverityWarning apgLogWarnings
apgSeverityError apgLogErrors
apgSeverityFatal apgLogFatalErrors
apgSeverityUnknown apgLogInfo

Example

This example writes an entry in the log file to report that script execution was successful.

<%# @LANGUAGE=JScript #%>
<%#

...

// Log that the script completed successfully
Log.Write("Script '" + Script.Path
          + "' completed successfully", apgSeverityInfo);

#%>

Applies To

Log Object