Jmeter的log输出控制(jmeter.log)
log_level.jmeter=ERROR log_level.jmeter.junit=DEBUG
在 jmeter.properties 中,修改Jmeter的日志级别为:ERROR, 否则产生巨大的日志文件jmeter.log,如果是需要查看详细的调试信息,可以将log_level.jmeter设置为DEBUG
对于断言,如果想打印更加详细的自定义日志到jmeter.log,可以这样做:
添加一个BeanShell Assertion,script这样填写:
import org.apache.log4j.Logger; if (increment==5 && vars.getObject("filterID").equals("NOT FOUND")) { Failure=true; FailureMessage="Create filter for task 5 times in a row,all failed!"; log.error("user-defined error, FailureMessage: " + FailureMessage); } else { System.out.println("filterID="+vars.getObject("filterID")); log.info("user-defined success, filterID=" + vars.getObject("filterID")); }
如果是运行到else里面,jmeter.log中就会打印这样的信息:
2013/10/07 02:20:24 INFO - jmeter.util.BeanShellTestElement: user-defined success, filterID=4104
如果是运行到if里面,jmeter.log中就会打印这样的信息:
2013/10/07 02:59:44 ERROR - jmeter.util.BeanShellTestElement: user-defined error, FailureMessage: Create filter for task 5 times in a row,all failed!