Whenever I run a new jmeter command from the CLI a new jmeter.log file is generated and I lose the contents written by the previous test run.
Example:
First I run the test script with :
jmeter -n -p .\config.properties -t .\path\to\jmeterScripFile.jmx -l .\path\to\jmeterScriptOutputFile.jtl
This generates a fresh jmeter.log file.
Then I run this command to generate a HTML Dashboard report:
jmeter -g .\path\to\jmeterScriptOutputFile.jtl -o .\path\to\TestResults\ReportHTML
This 2nd command overrides the previous jmeter.log file contents.
I would like each jmeter CLI command to generate a unique .log file. Something like jmeter-yyyymmdd-hhMMss
How could I achieve this?
You can override the default jmeter.log
file name using -j
command-line argument like
jmeter -j your-custom-log-name-here.log -n -t .....
the timestamp can be added by means of your operating system
If you want to make the change permanent and don't want to provide the new log file name via -j
command-line argument you can amend the log file prefix via log4j2.xml file like
change this line:
<File name="jmeter-log" fileName="${sys:jmeter.logfile:-jmeter.log}" append="false">
to something like:
<File name="jmeter-log" fileName="jmeter-${date:yyyyMMdd-hh-mm-ss}.log" append="false">
More information: How to Configure JMeter Logging