Configure Log Tracking Settings for a Test
Source code
'************************************************************************************************************************
' Description:
'
' This example uses the LogTrackingSettings object to configure your application's logging framework
' and enable the testing application to receive log messages that may be generated.
'
'************************************************************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
' Open the testing application, prepare objects variables, and open a test
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start the application
qtApp.Visible = True' Make the application visible
qtApp.Open "C:\Program Files (x86)\OpenText\UFT One\Tests\Test11"'Open the test. The path may vary depending on your versions.Set qtLogTrackingSettings = qtApp.Test.Settings.LogTracking ' Return LogTrackingSettings object for the current test
'Configure the LogTrackingSettings for the test
'(Before you do this, make sure that your application is ready and able to invoke logging requests)
With qtLogTrackingSettings

 ' Activate LogTracking functionality - When the test runs, the application can receive log messages
' from the log framework used by your application and include these messages in the run results
    .IncludeInResults = True' Configure the application
    .MinTriggerLevel = "ERROR"' Instructs the application to add a node to the run results for every log message with a severity level of "ERROR" or higher
    .IP = "127.0.0.1"'The IP address of the source from which to receive log framework messages
    .Port = "18081"'The port to listen to on the computer on which the log framework runs
' Configure log framework
    .EnableAutoConfig = True' Enables the application to configure the log framework
    .ConfigFile = "C:\My_Test_Suite\My_AUT\MyApplication.exe.log4net"' The log configuration file to modify when the run begins
    .MinConfigLevel = "WARN"' Set the verbosity level (log message severity level)to "WARN" so that messages with a severity of "WARN" and higher are logged
' Note: A large quantity of log messages may affect performance
    .RecoverConfigAfterRun = False' After the run session, do not to restore the log configuration file that existed prior to the beginning of this run
EndWith

qtApp.Test.Save ' Save modified test
qtApp.Test.Close ' Close test
Set qtLogTrackingSettings = Nothing' Release the LogTrackingSettings object
Set qtApp = Nothing' Release the Application object