load testing - log stack trace when HTTP request return error in Jmeter -
i want log error message failed http request. going run thread group 1b users , don't want use view result tree because logs , log file bloat.
using beanshell assertion below.
if (boolean.valueof(vars.get("debug"))) { if (responsecode.equals("200") == false) { log.info(sampleresult.getresponsemessage()); log.info("there problem"); } }
but in case prints error message interested log stack trace returned server.
i used method mention in this thread
for (a: sampleresult.getassertionresults()) { if (a.iserror() || a.isfailure()) { log.error(thread.currentthread().getname()+": "+samplelabel+": assertion failed response: " + new string((byte[]) responsedata)); } }
but in case don't object out of sampleresult.getassertionresults()
method , doesn't display in case of http request failure.
any idea how stack trace?
i figured out. sampleresult
has 1 more method called getresponsedataasstring()
. method returns response message. in case of error contains error message.
Comments
Post a Comment