2017-10-13 161 views
0

我是一个刚刚开始与Jira中的groovy合作以使一些任务自动化的程序员。在Jira中调试Groovy Scriptrunner内联编辑器

我正在尝试使用Jira中的内联编辑器编写自定义侦听器脚本,但还没有试图让Hello World程序工作。

我不知道脚本是否正在运行,并且看不到任何输出,而且我真的需要一些帮助来弄清楚如何调试脚本,最好是通过输出到某种控制台(甚至只是通过阅读Jira日志,如果有必要的话),这样我才能真正开始学习如何使用这个工具。

我正在使用信息HERE作为一般指导,开始学习如何使用内联编辑器。

对于更多的上下文,你可以看到另一个相关的问题,我问了HERE

我设置调试级别到调试的,我正在安装的侦听器的事件,如在这个截图,根据这些信息找到HEREDebug Config

这里是内联的截图我正在JIRA工作。在这张截图,我只是想输出“你好”,和刚才单击“预览”按钮: enter image description here

正如你所看到的,在屏幕底部的“结果”选项卡中,有没有什么意义。 '日志'选项卡也是空的,'时间'选项卡只是说'经过:0毫秒CPU时间:0毫秒',所以它似乎没有任何事情发生。

如果我检查服务器上的日志(在文件catalina.2017-10-13.txt),我看到下面的输出:

13-Oct-2017 07:01:50.942 WARNING [http-nio-8080-exec-6] com.sun.jersey.spi.container.servlet.WebComponent.filterFormParameters A servlet request, to the URI http://somevmserver:8080/rest/scriptrunner-jira/latest/listeners/com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener/params, contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected. 
13-Oct-2017 07:02:26.740 WARNING [http-nio-8080-exec-12] com.sun.jersey.spi.container.servlet.WebComponent.filterFormParameters A servlet request, to the URI http://somevmserver:8080/rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker, contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected. 
13-Oct-2017 07:02:26.974 WARNING [http-nio-8080-exec-1] com.sun.jersey.spi.container.servlet.WebComponent.filterFormParameters A servlet request, to the URI http://somevmserver:8080/rest/scriptrunner-jira/latest/listeners/com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener/preview, contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected. 

这个输出并不意味着一大堆我,但似乎很明显,它正在试图预览脚本的结果被填充。

我在内联编辑器中没有收到任何错误,而且代码非常简单,所以我不认为是这样。

我认为唯一的其他信息可以包括我认为恰当的是这是从我们的生产环境克隆的Jira的测试实例,其基本URL仍然设置为prod环境的URL。不知道这是否有任何影响,但我不是真正的Jira管理员,只是负责这样做的程序员,所以我不想绕过我不需要的地方摆弄。

谢谢!

回答

0

要在日志中看到您的调试消息“Hello”,您必须更新所选项目中的问题。底部的结果,日志和时间选项卡在这个视图中是无用的。只需在所选项目中触发Listener并更新问题并在atlassian-jira.log文件中搜索调试消息即可。

提示:要在浏览器中查看日志,你可以使用这个应用程序JIRA https://marketplace.atlassian.com/plugins/com.cps.lastLog/server/overview