jmeter之结果重定向
在使用jmeter与jenkins对接时,发现默认打印出来的日志就是正常的summary统计,如果要查看日志,只能通过jmeter.log去查看。
来来来,我们一起温习下jmeter的命令行参数
--? print command line options and exit -h, --help print usage information and exit -v, --version print the version information and exit -p, --propfile <argument> the jmeter property file to use -q, --addprop <argument> additional JMeter property file(s) -t, --testfile <argument> the jmeter test(.jmx) file to run. "-t LAST" will load last used file -l, --logfile <argument> the file to log samples to -i, --jmeterlogconf <argument> jmeter logging configuration file (log4j2.xml) -j, --jmeterlogfile <argument> jmeter run log file (jmeter.log) -n, --nongui run JMeter in nongui mode -s, --server run the JMeter server -H, --proxyHost <argument> Set a proxy server for JMeter to use -P, --proxyPort <argument> Set proxy server port for JMeter to use -N, --nonProxyHosts <argument> Set nonproxy host list (e.g. *.apache.org|localhost) -u, --username <argument> Set username for proxy server that JMeter is to use -a, --password <argument> Set password for proxy server that JMeter is to use -J, --jmeterproperty <argument>=<value> Define additional JMeter properties -G, --globalproperty <argument>=<value> Define Global properties (sent to servers) e.g. -Gport=123 or -Gglobal.properties -D, --systemproperty <argument>=<value> Define additional system properties -S, --systemPropertyFile <argument> additional system property file(s) -f, --forceDeleteResultFile force delete existing results files before start the test -L, --loglevel <argument>=<value> [category=]level e.g. jorphan=INFO, jmeter.util=DEBUG or com .example.foo=WARN -r, --runremote Start remote servers (as defined in remote_hosts) -R, --remotestart <argument> Start these remote servers (overrides remote_hosts) -d, --homedir <argument> the jmeter home directory to use -X, --remoteexit Exit the remote servers at end of test (non-GUI) -g, --reportonly <argument> generate report dashboard only, from a test results file -e, --reportatendofloadtests generate report dashboard after load test -o, --reportoutputfolder <argument> output folder for report dashboard
其中-l表示将请求日志另存为,-j表示将jmter运行文件另存为
我们在jmeter非界面中输出的日志叫标准输出,因此,如果想要将对应日志输出至标准日志,只要重定向为/dev/stdout
如:
jmeter.sh -n -t Base.jmx -j /dev/stdout ----将jmeter运行日志输出在屏幕中
jmeter.sh -n -t Base.jmx -l /dev/stdout ---将请求日志输出在屏幕中
重定向至标准输出后,对应的日志文件就为空了
Email:362299908@qq.com