Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear jmeter.log file during long run execution?

I have JMeter 3.0 node which has make load testing for 24 hours.
However, after 3 hours disk usage is overwhelmed by jmeter.log.

I tried to clean it on my own during a test execution but without any success. I have tried:

truncate jmeter.log --size 0
cat /dev/null > jmeter.log 

It always fails:

-rw-rw-r-- 1 tester tester 27591745 Sep 14 06:55 jmeter.log
-rw-rw-r-- 1 tester tester        0 Sep 14 06:55 load_execution.log
-rw-r--r-- 1 tester tester    48320 Sep 14 06:41 minion_load.jmx
-rw-rw-r-- 1 tester tester        0 Sep 14 06:42 report_res_20170914-064202.xml
[[email protected] dev-us1]# ll
total 1064
-rw-rw-r-- 1 tester tester 28311748 Sep 14 06:55 jmeter.log
-rw-rw-r-- 1 tester tester      219 Sep 14 06:55 load_execution.log
-rw-r--r-- 1 tester tester    48320 Sep 14 06:41 minion_load.jmx
-rw-rw-r-- 1 tester tester        0 Sep 14 06:42 report_res_20170914-064202.xml
[[email protected] dev-us1]# ll
total 104
-rw-rw-r-- 1 tester tester 29422392 Sep 14 06:56 jmeter.log
-rw-rw-r-- 1 tester tester        0 Sep 14 06:56 load_execution.log
-rw-r--r-- 1 tester tester    48320 Sep 14 06:41 minion_load.jmx
-rw-rw-r-- 1 tester tester        0 Sep 14 06:42 report_res_20170914-064202.xml
[[email protected] dev-us1]# ll

Another file is cleared periodically. I used crontab for it.

I am starting JMeter in not GUI mode.

How to clear default jmeter.log or set any threshold when file reach .. size?

like image 626
catch23 Avatar asked Sep 19 '25 17:09

catch23


1 Answers

If you are not particularly interested in contents of jmeter.log on INFO level, instead of truncating the log, you can reduce log level to WARN or ERR in jmeter.properties. Change:

log_level.jmeter=INFO

to

log_level.jmeter=WARN

If you want to keep logging to INFO or DEBUG level, consider using Excalibur logger, which supports log rotation and can also be configured via jmeter.properties:

# Excalibur logging provides the facility to configure logging using
# configuration files written in XML. This allows for such features as
# log file rotation which are not supported directly by JMeter.
#
# If such a file specified, it will be applied to the current logging
# hierarchy when that has been created.
# 
#log_config=logkit.xml

Direct log truncation is generally not a recommended way to control log size for log4j and especially log4j2, as it may cause various issues (e.g. JMeter to stop writing log completely, or on next write, JMeter may restore large size again, except the beginning of the file will consist of NULL characters).

like image 65
ytrewq Avatar answered Sep 21 '25 12:09

ytrewq