About Transaction Log
The Transaction Log page of the virtual service editor displays information on incoming requests and outgoing responses that happened during the current service run. Here is a sample view of the page:
The page contains information on all the requests that were sent to the virtual service, including the requests for which this service does not have a virtual operation.
To view contents of a request or response, select this request or response on the page. The request (or response) data – body contents, headers and other – will be on the right (see the image above).
Successful and Failed Transactions
The page marks successfully processed requests with green dots, and failed requests with red dots. Note that even if the virtual service responds with an error code, the entire transaction can be marked as successful, because an error code could be a normal response to an invalid request.
Virtual services treat transactions as successful or failed depending on the assertion results. To find out what assertion failed:
Select the request (the assertions check incoming requests). Information on the request will be displayed on the right.
Expand the Assertions section and find the failed assertion there. The section will also mention the reason of the fail:
To find a record on the list quickly, type any part of its contents in the Filter edit box. The panel applies the filter and displays matching items on-the-fly:
You can type any part of the displayed item: request header details, response code, log timestamp, and so on.
As we said above, the log stores information on transactions that happened during the current run. By default, the page displays 25 last transactions. This number is specified by the Transaction logs to keep setting. To access it quickly, click on the Transaction Log toolbar. Alternatively, you can get to the option through the Preferences > Virtual Service Transactions dialog.
Note that storing a large amount of log data will consume lots of memory. So, we do not recommend using high values for this setting. Keep it as low as possible for your tests.
To clear the log data manually, click Clear transaction log on the log toolbar.
Total Number of Requests and Responses
You can find the total number or received requests and sent responses in the toolbar of the virtual service editor, or in the property editor on the right:
Enable and Disable Logging
To disable logging, click Pause continuous updates in the log toolbar. The toolbar item will change to Resume continuous updates. Click this button to enable logging:
Download Transaction Log
Go to APIs (Virtual) in the Navigation Panel and select the required Virtual Service. In the Transaction log options, you can check the download symbol.
However, if there are no transactions logged in the transaction log, the download transaction log icon/button will be disabled.
In the transaction log options, click on the download symbol. This action will trigger a pop-up window with a File Explorer, allowing the user to specify the location and file name for the log. The file name will be specific to the VirtService and include the VirtService name as well as a timestamp.
Choose the desired location to save the file. The transaction log will be stored in a file specific to the selected VirtService, with the name of that VirtService and the time stamp.
The file is saved in JSON format. The file contains all the transaction details: virtName, requestData and responseData. Here is a sample of the downloaded file.