我想使用 system.out.println()
调试一个程序
在运行 JIRA 时检查 eclipse 中的流和变量值
插件是一个 Servlet 。
当我对 eclipse 中的代码进行一些更改时,它会反射(reflect)在
浏览器,但是当我使用 system.out.println
我应该在哪里看到
输出?
示例代码:
@RequiresXsrfCheck
protected String doExecute()
{
LOG.info("BulkCloneDetails doExecute start...");
filterUrl = null;
cloneSubTasks = false;
cloneAttachments = false;
deleteAfterClone = false;
requestId = null;
issues = null;
getServerInfoFromPage();
**System.out.println("Print something here");**
errorsCollection.put("filterPath", i18n.getText("Remote login failed"));
addErrors(errorsCollection);
return SUCCESS;
}
最佳答案
您可以在终端中的文件上加一个尾部,以便您可以看到它是如何与之交互的。在我正在处理的网络应用程序上,我使用以下方法。
Username$ cd /Applications/tomcat/apache-tomcat-6.0.16/logs
然后输入
tail –f catalina.out
然后这将打印到您的终端窗口。我不得不在几个项目中使用这种方法。我建议您使用 system.out.println("Name of the File I am printing from")
这样,如果您有多个这样的文件,那么您将知道它们来自哪里以及它们的顺序.
关于java - 使用 servlet 时如何使用 system.out.println,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11325440/