jMeter - Listeners
Listeners provide access to the information JMeter gathers about the test cases while JMeter runs. The results or information gathered by listeners can be shown in the form of −
- log file
All listeners write the same raw data to the output file when one is specified.
The default items to be saved can be defined in one of the following two ways −
In the jmeter.properties (or user.properties) file. This file is present in the /bin folder of JMeter.To change the default format, find the following line in jmeter.properties −
By using the Config popup as shown in the following screenshot −
JMeter creates results of a test run as JMeter Text Logs(JTL). These are normally called JTL files, as that is the default extension − but any extension can be used.
If multiple tests are run using the same output file name, then JMeter automatically appends new data at the end of the file.
The listener can record results to a file but not to the UI. It is meant to provide an efficient means of recording data by eliminating GUI overhead.
When running in −
GUI mode − use the listener Simple Data Writer
non-GUI mode − the -l flag can be used to create a data file.
Listeners can use a lot of memory if there are a lot of samples. To minimize the amount of memory needed, use the Simple Data Write with CSV format.
CSV Log format
The CSV log format depends on which data items are selected in the configuration. Only the specified data items are recorded in the file. The order of appearance of columns is fixed, and is as follows −
|timeStamp||in milliseconds since 1/1/1970||1354223881017|
|label||sampler label||HTTP Request|
|responseCode||e.g. 200, 404||200|
|threadName||Thread Group 1-1|
|success||true or false||true|
|bytes||number of bytes in the sample||34908|
|grpThreads||number of active threads in this thread group||1|
|allThreads||total number of active threads in all groups||1|
|Filename||if Save Response to File was used|
|latency||time to first response||132|
|SampleCount||number of samples (1, unless multiple samples are aggregated)||1|
|ErrorCount||number of errors (0 or 1, unless multiple samples are aggregated)||0|
|Hostname||where the sample was generated||LaptopManisha|
|IdleTime||number of milliseconds of 'Idle' time (normally 0)|
Saving Response Data
The response data can be saved in the XML log file if required. However it does not allow to save large files and images. In such cases, use the Post-Processor Save_Responses_to_a_file. This generates a new file for each sample, and saves the file name with the sample. The file name can then be included in the sample log output. The data will be retrieved from the file if necessary when the sample log file is reloaded.
Loading (reading) response data
To view an existing results file, you can use the file "Browse..." button to select a file. If necessary, just create a dummy testplan with the appropriate Listener in it.
Saving the Listener GUI Data
JMeter is capable of saving any listener as a PNG file. To do so,
Select the listener in the left panel by selecting Edit > Save As Image. A file dialog appears.
Enter the desired name.
Save the listener.