OnLogEvent Event

Applies to TestComplete 15.64, last modified on May 16, 2024

Occurs before the test engine posts an event notification to the test log.


OnLogEvent(SenderLogParams) Parameters
Sender [in] Required Variant
LogParams [in] Required A LogParams object


This event occurs before the test engine posts an event notification to the test log. You can create the OnLogEvent handler to perform needed actions upon posting event messages to the log.

The test engine posts event messages when the test simulates actions over a window. You can change the priority of these event messages if these actions are simulated over the main window of the tested application.


The event has the following parameters:


The Event control that processes the event.


Specifies the LogParams object that contains the node attributes.

To avoid recursive calls, do not use the Log.Event method within the event handler of the OnLogEvent event.


For information on how to create an event handler for this and other TestComplete events, see Handling Events.

If you configure your test project to track Selenium Server events during the test run, keep in mind that TestComplete does not support creating handlers for those events.


JavaScript, JScript

function ProjectEvents1_OnLogEvent(Sender, LogParams)
  var w;
  w = Sys.Process("TestedApp").Window("MainWindow", "*", -1);
  if (Sys.Desktop.ActiveWindow().Name == w.Name)
    LogParams.Priority = pmHigher;


def ProjectEvents1_OnLogEvent(Sender, LogParams):
  w = Sys.Process("TestedApp").Window("MainWindow", "*", -1)
  if (Sys.Desktop.ActiveWindow().Name == w.Name):
    LogParams.Priority = pmHigher


Sub ProjectEvents1_OnLogEvent(Sender, LogParams)
  Set w = Sys.Process("TestedApp").Window("MainWindow", "*", -1)
  If Sys.Desktop.ActiveWindow.Name = w.Name Then
    LogParams.Priority = pmHigher
  End If
End Sub


procedure ProjectEvents1_OnLogEvent(Sender, LogParams : OleVariant);
  w : OleVariant;
  w := Sys.Process('TestedApp').Window('MainWindow', '*', -1);
  if Sys.Desktop.ActiveWindow.Name = w.Name then
    LogParams.Priority := pmHigher;

C++Script, C#Script

function ProjectEvents1_OnLogEvent(Sender, LogParams)
  var w;
  w = Sys["Process"]("TestedApp")["Window"]("MainWindow", "*", -1);
  if (Sys["Desktop"]["ActiveWindow"]()["Name"] == w["Name"])
    LogParams["Priority"] = pmHigher;

See Also

Posting Messages to the Log
LogParams Object
OnLogMessage Event
OnLogError Event
OnLogWarning Event
OnLogCheckpoint Event
OnLogPicture Event
OnLogFile Event
OnLogLink Event
Handling Events
Event Control

Highlight search results