Configure Log Tracking Settings for a UFT Test
Source code
' Description:
' This example uses the LogTrackingSettings object to enable UFT to
' configure your application's logging framework and receive log messages
' that may be generated.

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

' Open UFT, prepare objects variables, and open a test

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT
qtApp.Visible = True ' Make the UFT application visible
qtApp.Open "C:\Program Files\Micro Focus\Unified Functional Testing\Tests\Test11" 'Open the test

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, UFT will be able to receive log messages
    ' from the log framework used by your application and include these messages in the run results
    .IncludeInResults = True

    ' Configure QuickTest
    .MinTriggerLevel = "ERROR" ' Instructs UFT to add a node to the run results for every log message with a severity level of "ERROR" or higher
    .IP = "" 'The IP address of the source from which UFT receives log framework messages
    .Port = "18081" 'The port that UFT listens to on the computer on which the log framework runs

    ' Configure log framework
    .EnableAutoConfig = True ' Enables UFT 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 will be logged
    ' Note: A large quantity of log messages may affect performance
    .RecoverConfigAfterRun = False ' After the run session, instructs UFT not to restore the log configuration file that existed prior to the beginning of this run

End With

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