Monitoring a log file during a test

If a log file is configured on any of the bound infrastructure components of the project, that file can be monitored during the execution of a test.

To configure how the file is to be monitored, click the Monitoring tab of an open test in the Test Factory (F10).

To add an existing log file to monitor, click Add and select Log File from the menu. To copy an existing log file, select its entry and click Copy. To remove an existing log file, select its entry and click Remove.

On the right of the window, select the specific log file to monitor from the Log File menu. This log file must be configured for monitoring in the Logical View of Architecture School.

Monitor remote log files

If the log file to be monitored is on a remote host defined in the current environment, you must configure a connection on the remote host that defines how HCL OneTest™ API connects to it. For more information, see Adding a host to the Physical view. For an example, see Example: Monitoring a remote log file.

Filter options

Under the Filter tab, you can filter the log entities to capture. Use the Business Correlation ID, and a starting and ending transaction filter.

In the Regex field under Business Correlation, you can specify an expression that is unique to each business transaction (for example, a reservation number). You can also click Edit to use the expression builder to create the regular expression. For more information, see Creating and monitoring an infrastructure component.

The Business Correlation is used with the Technical Correlation, which is configured on the logical component’s log file setup. If you can match the Technical Correlation in entities where the Business Correlation is found, you can filter and identify only those log entries that interest you.

In the example that is shown, TX_ID is used in a capture group that is defined in the regular expression. TX_ID is a tag into which the returned reservation number is being stored. At run time, TX_ID is extracted from the log and must match the value in the tag. If it does, the Business Correlation is matched and HCL OneTest API continues to try and match the Technical Correlation as well.

In the Transaction panel, you can use the Starts with and Finishes with filters to reduce the number of entries that are being matched. In the Starts with field, enter an expression that filters anything that comes before the expression. In the Finishes with field, enter an expression that will filter anything that comes after the expression.

Log monitor actions

Under the Actions tab you can define specific test actions that are to be taken when a log entity matches the specified expression. When you monitor a log file during a test, you typically create actions that handle unexpected conditions (for example, errors or exceptions) in the log.

Note: Actions are matched in the order that they are defined in the editor. If no actions are defined or none of the defined actions are matched, the entry is sent to the test console as a normal message.

For more information about configuring log monitoring actions, see Creating and monitoring an infrastructure component.