Clearing JMeter logs usually means removing or truncating the jmeter.log file that records JMeter’s startup messages, warnings, errors, and other diagnostic information. The safest approach is to stop JMeter first, locate the log file, and then delete it or empty its contents. JMeter can create a fresh log when it starts again. If you are running a test from the command line, use the -j option to choose the log file for that run. Just as importantly, do not confuse JMeter’s application log with test result files: clearing jmeter.log does not clear a JTL results file.
What Does the JMeter Log Contain?
JMeter’s main application log is commonly named jmeter.log. It records information about the JMeter process itself, such as startup details, plugin loading, configuration problems, test errors, and warnings. The log is useful when JMeter fails to launch, a plugin behaves unexpectedly, or a test produces errors that are not obvious in the test plan.
The log’s location can vary. It depends on how JMeter was started, the current working directory, and whether a log file was specified at launch. If you start JMeter through a script, service, IDE, or automation tool, the log may not be in the folder you expect. Search for jmeter.log or check the launch command before deleting anything.
JMeter may also create older or rolled log files, depending on the logging configuration. These can have numbered suffixes or other names. Review the files before removing them, especially if you need past diagnostic information for troubleshooting or an audit.
Stop JMeter Before Clearing Its Log
For the most reliable cleanup, stop the test and close JMeter before deleting or truncating the log. A running JMeter process may still have the file open. Removing or editing an active log can lead to confusing results: JMeter may continue writing to the existing file handle, the file may be recreated, or new messages may not appear where you expect.
Before closing JMeter, save any test plan changes and note down errors you still need to investigate. If the log contains information you may need later, copy it to a separate folder first. Once the process has shut down cleanly, you can clear the log without interrupting JMeter’s logging activity.
Find the JMeter Log File
Start by checking the folder from which you launched JMeter. In some installations, the log is in the JMeter bin directory; in others, it is in the current working directory or a location set by the launch command. If you use a custom script, inspect that script for a -j option, which specifies the JMeter log file.
You can also search your JMeter installation and the directory used by your test runner for jmeter.log. On a shared machine, check the file’s path and modification time to confirm that it belongs to the JMeter process you intend to clean up. Avoid deleting a log just because its name matches if another JMeter job may be using it.
Clear JMeter Logs on Windows
On Windows, close JMeter and any command window running a test. Then locate jmeter.log in File Explorer. You can delete the file, or open it in a text editor, remove its contents, and save it. Deleting the file is usually simpler; JMeter will typically create a new log when it starts, provided it has permission to write to the directory.
To empty the file from PowerShell while preserving the file itself, use the following command after confirming the path:
Clear-Content "C:\path\to\jmeter.log"
To remove it instead, use:
Remove-Item "C:\path\to\jmeter.log"
Replace the example path with the actual location of your log. If Windows reports that the file is in use, make sure all JMeter processes have stopped. Do not force-delete a file that may belong to an active test run.
Clear JMeter Logs on Linux or macOS
On Linux or macOS, stop JMeter and move to the directory containing the log, or use its full path. To empty the file while keeping it in place, run:
truncate -s 0 /path/to/jmeter.log
Alternatively, remove the file with:
rm /path/to/jmeter.log
Check the path carefully before running a removal command. If JMeter needs to write to the directory, the account that runs JMeter must have appropriate permissions. When in doubt, preserve a copy before clearing the log:
cp /path/to/jmeter.log /path/to/jmeter.log.backup
Choose a Fresh Log File for Each Run
If you run JMeter from the command line, you can direct its log to a specific file with the -j option. For example:
jmeter -n -t test.jmx -j logs/run-01.log -l results/run-01.jtl
Here, -j sets the JMeter application log, while -l sets the test results file. Using a distinct log name for each run makes it easier to compare failures and prevents older messages from being mixed with a new test’s output. Create the destination directory beforehand and make sure JMeter can write to it.
You can use the same approach with a Windows batch launch, adjusting the command for your installation. The key is to give each run its own log path when you want to retain diagnostic history, or deliberately reuse a path when your process is designed to replace or manage that log.
Understand the Difference Between Logs and Results
One common cleanup mistake is deleting the wrong file. The JMeter application log is usually jmeter.log. A results file is often named with a .jtl extension, although teams can choose other names. The results file contains sampler outcomes and metrics, such as response times, success status, and other fields enabled in the test configuration.
Clearing jmeter.log does not remove recorded test results. Likewise, deleting a JTL file does not clear JMeter’s diagnostic messages. Before removing either file, decide which information you want to reset. Results may be needed for reports, comparisons, or performance analysis, so do not delete them as part of log cleanup unless that is your intention.
Remove Old or Rolled Log Files Carefully
If your logging configuration creates archived or rolled files, clearing only the current jmeter.log may not free all the space used by JMeter logs. Look for related files in the same directory, including files with numeric suffixes or a configured archive pattern. Check their dates and sizes before removing them.
For recurring cleanup, set a retention policy rather than deleting files blindly. For example, keep logs for a defined number of days, retain logs from failed runs, or archive them before removing older copies. This helps control disk usage while preserving useful evidence when a test fails.
Clear the Log Viewer Without Losing the Log
JMeter’s GUI may provide a log viewer that displays messages while the application is running. Clearing or refreshing what you see in a viewer is not necessarily the same as clearing the physical log file on disk. If your goal is to free disk space or start with an empty file, verify the log file itself after closing JMeter.
Conversely, you do not have to delete the log file just to investigate a problem. Searching it for terms such as ERROR, WARN, or a plugin name can be more useful than wiping it. If you clear the log before capturing the relevant error, you may lose information needed to diagnose the issue.
Prevent JMeter Logs From Growing Too Large
Repeatedly clearing logs is a short-term fix. If the file grows quickly, investigate why. A noisy plugin, repeated connection failures, or an overly detailed logging level can generate many messages. Review the warnings and errors first, then adjust the relevant component or logging configuration if appropriate. Avoid suppressing useful messages just to make the file smaller.
JMeter’s logging behavior is configured through its logging settings, including the configuration in the installation’s bin directory. Configuration details can differ between JMeter versions, so make a backup before changing them and consult the documentation for the version you run. For scheduled tests, use predictable log paths and a separate retention process to archive or remove outdated files.
Common Mistakes to Avoid
- Deleting a log while a test is running: Stop the JMeter process first to avoid incomplete or confusing logging behavior.
-
Removing the results file by mistake: Check whether you are handling
jmeter.logor a JTL results file. -
Assuming every installation uses the same path: Check the current working directory and any
-jlaunch option. - Deleting archived logs without checking them: Older files may contain the only record of a previous failure.
- Ignoring permissions: JMeter must have write access to the folder to create a fresh log.
- Clearing evidence too early: Save relevant error messages before resetting the log.
Conclusion
To clear JMeter logs safely, stop JMeter, confirm the location of the correct jmeter.log file, and then delete it or truncate its contents. Use -j to choose a dedicated log file for command-line runs, and remember that -l controls the separate test results file. For ongoing test environments, use clear file naming and a retention policy instead of deleting logs without checking them. These steps let you start with a clean JMeter log while keeping important test results and troubleshooting evidence safe.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.