_util.LogLine Method

Adds an entry to the Microsoft Windows event log, which you can view using the Event Viewer.

Remarks

  • Use this method to help you analyze the performance of your support set or debug its functionality.
  • When working with Chrome, the LogLine method adds the content to the Chrome console (and not the Windows event log). 
    The log level is controlled via the settings for the UFT Testing Agent extension in Chrome.

Syntax

JScript 
public function LogLine( 
   text : String,
   severity : LogSeverity,
   Id : int,
   category : short
);

Parameters

text
The text to add to the log.
severity

The severity of this log entry (the event type).

A predefined constant (without quotes) or value.

One of:

LogSeverity_Success0
LogSeverity_Information1
LogSeverity_Warning2
LogSeverity_Failure3
LogSeverity_Error4
Id

The event ID number for this log entry.

Optional. Default = 0

category

A positive integer that represents the category to which this log entry belongs.

Optional. Default = None.

Note: The categories are not predefined; you can define them according to your needs.

Example

The following JavaScript function runs the test object method GoToUsedBookPage (on the Web Extensiblity sample Book object) and calls the _util.LogLine method to add an entry to the Microsoft Windows event log indicating that the method ran. 

function GoToUsedBooksPage()
{ // Click the link in the first cell of the third row.
   _elem.rows[3].cells[0].children[1].click();
   _util.LogLine("Running GoToUsedBooksPage.", LogSeverity_Information, 752, 2);
}