properties 文件
https://jmeter.apache.org/usermanual/listeners.html
The default items to be saved can be defined in the jmeter.properties (or user.properties) file. The properties are used as the initial settings for the Listener Config pop-up, and are also used for the log file specified by the -l command-line flag (commonly used for CLI mode test runs).
To change the default format, find the following line in jmeter.properties:
jmeter.save.saveservice.output_format=
The information to be saved is configurable. For maximum information, choose “xml” as the format and specify “Functional Test Mode” on the Test Plan element. If this box is not checked, the default saved data includes a time stamp (the number of milliseconds since midnight, January 1, 1970 UTC), the data type, the thread name, the label, the response time, message, and code, and a success indicator. If checked, all information, including the full response data will be logged.
The following example indicates how to set properties to get a vertical bar ("|") delimited format that will output results like:.
timeStamp|time|label|responseCode|threadName|dataType|success|failureMessage
02/06/03 08:21:42|1187|Home|200|Thread Group-1|text|true|
02/06/03 08:21:42|47|Login|200|Thread Group-1|text|false|Test Failed:
expected to contain: password etc.
The corresponding jmeter.properties that need to be set are shown below. One oddity in this example is that the output_format is set to csv, which typically indicates comma-separated values. However, the default_delimiter was set to be a vertical bar instead of a comma, so the csv tag is a misnomer in this case. (Think of CSV as meaning character separated values)
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.assertion_results_failure_message=true
jmeter.save.saveservice.default_delimiter=|
The full set of properties that affect result file output is shown below.
#---------------------------------------------------------------------------
# Results file configuration
#---------------------------------------------------------------------------
# This section helps determine how result data will be saved.
# The commented out values are the defaults.
# legitimate values: xml, csv, db. Only xml and csv are currently supported.
#jmeter.save.saveservice.output_format=csv
# true when field should be saved; false otherwise
# assertion_results_failure_message only affects CSV output
#jmeter.save.saveservice.assertion_results_failure_message=true
#
# legitimate values: none, first, all
#jmeter.save.saveservice.assertion_results=none
#
#jmeter.save.saveservice.data_type=true
#jmeter.save.saveservice.label=true
#jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
#jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
#jmeter.save.saveservice.response_data.on_error=false
#jmeter.save.saveservice.response_message=true
#jmeter.save.saveservice.successful=true
#jmeter.save.saveservice.thread_name=true
#jmeter.save.saveservice.time=true
#jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
#jmeter.save.saveservice.latency=true
#jmeter.save.saveservice.connect_time=true
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
#jmeter.save.saveservice.bytes=true
#jmeter.save.saveservice.sent_bytes=true
#jmeter.save.saveservice.url=false
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
#jmeter.save.saveservice.thread_counts=true
#jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=true
# Timestamp format - this only affects CSV output files
# legitimate values: none, ms, or a format suitable for SimpleDateFormat
#jmeter.save.saveservice.timestamp_format=ms
#jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
# For use with Comma-separated value (CSV) files or other formats
# where the fields' values are separated by specified delimiters.
# Default:
#jmeter.save.saveservice.default_delimiter=,
# For TAB, since JMeter 2.3 one can use:
#jmeter.save.saveservice.default_delimiter=\t
# Only applies to CSV format files:
# Print field names as first line in CSV
#jmeter.save.saveservice.print_field_names=true
# Optional list of JMeter variable names whose values are to be saved in the result data files.
# Use commas to separate the names. For example:
#sample_variables=SESSION_ID,REFERENCE
# N.B. The current implementation saves the values in XML as attributes,
# so the names must be valid XML names.
# JMeter sends the variable to all servers
# to ensure that the correct data is available at the client.
# Optional xml processing instruction for line 2 of the file:
#jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
# Prefix used to identify filenames that are relative to the current base
#jmeter.save.saveservice.base_prefix=~/
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false
# Put the start time stamp in logs instead of the end
sampleresult.timestamp.start=true
# Whether to use System.nanoTime() - otherwise only use System.currentTimeMillis()
#sampleresult.useNanoTime=true
# Use a background thread to calculate the nanoTime offset
# Set this to ≤ 0 to disable the background thread
#sampleresult.nanoThreadSleep=5000
The date format to be used for the timestamp_format is described in SimpleDateFormat. The timestamp format is used for both writing and reading files. If the format is set to “ms”, and the column does not parse as a long integer, JMeter (2.9+) will try the following formats:
yyyy/MM/dd HH:mm:ss.SSS
yyyy/MM/dd HH:mm:ss
yyyy-MM-dd HH:mm:ss.SSS
yyyy-MM-dd HH:mm:ss
MM/dd/yy HH:mm:ss (this is for compatibility with previous versions; it is not recommended as a format)
Matching is now also strict (non-lenient). JMeter 2.8 and earlier used lenient mode which could result in timestamps with incorrect dates (times were usually correct).
中文版:
#------------------------------------------------- --------------------------
# 结果文件配置
#----------- -------------------------------------------------- ------
# 此部分帮助确定如何保存结果数据。
# 注释掉的值是默认值。
# 合法值:xml、csv、db。目前仅支持 xml 和 csv。
#jmeter.save.saveservice.output_format=csv
# 字段应保存时为真;false 否则
# assertion_results_failure_message 只影响 CSV 输出
#jmeter.save.saveservice.assertion_results_failure_message=true
#
# 合法值:none, first, all
#jmeter.save.saveservice.assertion_results=none
#
#jmeter.save.saveservice.data_type=true
#jmeter.save.saveservice.label=true
#jmeter.save.saveservice.response_code=true
# CSV 输出当前不支持 response_data
#jmeter.save.saveservice.response_data=false
#保存失败样本的响应数据
#jmeter.save.saveservice.response_data.on_error=false
#jmeter.save.saveservice.response_message=true
#jmeter.save.saveservice.successful=true
#jmeter.save.saveservice.thread_name=true
#jmeter. save.saveservice.time=true
#jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
#jmeter.save.saveservice.latency=true
#jmeter.save.saveservice.connect_time=true
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
#jmeter.save.saveservice.bytes=true
#jmeter.save.saveservice.sent_bytes=true
#jmeter.save.saveservice.url=false
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
#jmeter.save.saveservice.thread_counts=true
#jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=true
# 时间戳格式 - 这仅影响 CSV 输出文件
# 合法值:none、ms 或适合 SimpleDateFormat 的格式
#jmeter.save.saveservice.timestamp_format=ms
#jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
# 用于逗号分隔值 (CSV) 文件或其他格式
# 其中字段' 值由指定的分隔符分隔。
# 默认值:
#jmeter.save.saveservice.default_delimiter=,
# 对于 TAB,从 JMeter 2.3 开始可以使用:
#jmeter.save.saveservice.default_delimiter=\t
# 仅适用于 CSV 格式的文件:
# 打印字段名作为第一行in CSV
#jmeter.save.saveservice.print_field_names=true
# JMeter 变量名称的可选列表,其值将保存在结果数据文件中。
# 使用逗号分隔名称。例如:
#sample_variables=SESSION_ID,REFERENCE
# 注意当前实现将 XML 中的值保存为属性,
因此名称必须是有效的 XML 名称。
# JMeter 将变量发送到所有服务器
# 以确保客户端提供正确的数据。
# 文件
第2 行的可选 xml 处理指令:#jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
# 用于标识文件名的前缀相对于当前基数
#jmeter.save.saveservice.base_prefix=~/
# 以 XML 或 CSV 输出写的每一行上的AutoFlush
# 将此设置为 true 将导致在崩溃的情况下较少的测试结果数据丢失
# 但对性能有影响,特别是对于密集测试(低暂停或无暂停)
# 从 JMeter 2.10 开始,默认情况下这是错误的
#jmeter.save.saveservice.autoflush=false
# 将开始时间戳记在日志中而不是结束
样本结果.timestamp.start=true
# 是否使用 System.nanoTime() - 否则只使用 System.currentTimeMillis()
#sampleresult.useNanoTime=true
# 使用后台线程来计算 nanoTime 偏移量
# 将此设置为 ≤ 0 以禁用后台线程
#sampleresult.nanoThreadSleep=5000