如何在jmeter中获取Bean Shell脚本的完整日志 [英] How to get the complete log for bean shell scripts in jmeter

查看:1325
本文介绍了如何在jmeter中获取Bean Shell脚本的完整日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache JMeter 3.1,在我的测试套件中,我有一个BeanShell PreProcessor.运行脚本时,在Log Viewer中,我可以看到Bean Shell脚本中有错误.但是错误消息非常有限,如何获得完整的错误?

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?

例如,我在Log Viewer中看到的错误如下,

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
}

这样,完整的异常堆栈跟踪将在 jmeter.log 文件

This way full exception stacktrace will be available in jmeter.log file

我宁愿建议切换到 JSR223元素 Groovy语言,因为Groovy更加符合Java,并提供了更好的性能.有关详细信息,请参见 Groovy是新黑人.

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.

这篇关于如何在jmeter中获取Bean Shell脚本的完整日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆