Enabling extended error logging in JMeter

Here's a simple way to log request and response information for each HTTP error in JMeter.

In some testing scenarios especially when faced with errors being received at very specific conditions - you may want to understand what is happening on a more granular level.

With JMeter you are able to capture every single request and response and output it to a file using the in-built functionality of the View Results Tree addin.

DISCLAIMER: We generally tell our customer's to disable the View Results Tree when running your final tests for two main reasons:

  1. Reporting-based add-ins such as the View Results Tree tend to take up Grid node CPU usage as well as increase the size of archives due to the logs being created and stored on each node.

  2. Flood has it's own Reporting engine that does not use the reporting-based add-ins from JMeter so it is not needed when running through the platform.

The first step to logging every request and response for a Flood is to add the View Results Tree add-in to your JMeter script.​

You will need to specify the path that you want to save the output to - for readability and structure we will create an XML formated file for this log. We will also save it using the full local path on each Grid node which is /data/flood/files/output-errors.xml

We are also generally only interested in seeing requests and responses for errors so we will need to tick the Log/Display Only Errors option.​

When clicking on the Configure button - we can decided what type of information we require to be written in the log file. For this scenario we'll choose the following items:​

We'll be saving it as an XML file - with all Request Headers and data, response codes and data, and some timestamps and connect time information.

This should give us enough information on any errors that we may observe during a test to see what is happening.

Here's an example log file that was run to aid in verifying some 500 error responses that were being observed: ​​

The <responseData> tag shows the full 500 page error response being returned by the target server.

In the <queryString> tag we can see the exact request we sent to get the 500 response. This kind of information is very helpful as it may be data contained within the request that is causing the issue. ​