I am using Apache JMeter 3.1 and in my test suite I have a BeanShell PreProcessor
. When I run the scrip, in the Log Viewer
I can see there are errors in the bean shell script. But the error message is very limited, how can I get the complete error?
For example, an error I see in the Log Viewer
is as follows,
ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``// Following is a sample for input // "abc.org/def/xyz . . . ''
Is there a way I can retrieve the complete error?
You can enable debug output in at least 2 ways:
- Adding debug() directive to the beginning of your Beanshell script - debugging output will go to STDOUT (JMeter console)
Putting your code inside the try block like:
try {
//your code here
}
catch (Throwable ex) {
log.error("Something went wrong", ex);
throw ex
}
This way full exception stacktrace will be available in jmeter.log file
I would rather recommend switching to JSR223 Elements and Groovy language as Groovy is more Java-compliant and provides better performance. See Groovy Is the New Black for details.