我怎样才能从Java code输出到詹金斯控制台? [英] How can I output from java code to the Jenkins console?
问题描述
我的java code。与许多的System.out.println()
补充道。其中之一是在主方法的开始。当我开始在NetBeans中的code,我看到所有这些控制台输出的println
。
I have java code with many System.out.println()
added. One of them is at the start of the "main" method. When I start the code in NetBeans, I see the console output with all these println
.
当我开始用叉子和放大器詹金斯/蚂蚁类;产卵设置为true(作为一个单独的任务),它运行,但没有被的println投入对詹金斯控制台。
When I start the class in Jenkins/ant with fork&spawn set to true (as a separate task), it runs, but no println is put to the Jenkins console.
我可以做的System.out.println写信给詹金斯控制台?
Can I make System.out.println to write to Jenkins console?
我发现了一个有趣的修复詹金斯问题,他们说:一个变量对象模型的出可以用来写邮件到构建控制台怎么了?
I have found an interesting repaired Jenkins issue, they say "a variable 'out' of the object model can be used to write messages to the build console" How?
编辑:
在同一个项目,未催生输出应用中的标准输出
进入詹金斯控制台确定。
In the same project, the applications that are not spawned output their stdout
into the Jenkins console OK.
编辑2。
请注意,我要输出到詹金斯控制台,而不是一个文件。
Edit 2. Please, Notice that I want to output to Jenkins console, not to a file.
推荐答案
的 TaskListener 有一个方法 getLogger()
使用您可以在控制台输出打印。 的System.out.println
将不被重定向到詹金斯控制台输出。
TaskListener of Jenkins has a method getLogger()
using which you can print in the console output. System.out.println
will not be redirected to Console output in Jenkins.
这篇关于我怎样才能从Java code输出到詹金斯控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!