How to get the complete log for bean shell scripts in jmeter

喜夏-厌秋 提交于 2019-12-06 01:49:17

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41986344/how-to-get-the-complete-log-for-bean-shell-scripts-in-jmeter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!