我使用Liferay portlet bundle 6.2(Tomcat),我在portlet首选项中保存了一些变量。它没有问题,但如果我用System.out.println
打印条目,它不会在控制台上输出。 Liferay中哪里有System.out.println
输出?我如何在Liferay中使用System.out.println
,是否有其他解决方案而不是System.out.println
?
在下面我发布代码,来自哪里
谢谢
public void addEntry(ActionRequest request, ActionResponse response) {
try {
PortletPreferences prefs = request.getPreferences();
String[] guestbookEntries = prefs.getValues("guestbook-entries",
new String[1]);
ArrayList<String> entries = new ArrayList<String>();
if (guestbookEntries != null) {
entries = new ArrayList<String>(Arrays.asList(prefs.getValues(
"guestbook-entries", new String[1])));
}
String userName = ParamUtil.getString(request, "name");
String message = ParamUtil.getString(request, "message");
String customer = ParamUtil.getString(request, "customer");
String entry = userName + "^" + message + "^" + customer;
entries.add(entry);
System.out.println("hallo");
String[] array = entries.toArray(new String[entries.size()]);
prefs.setValues("guestbook-entries", array);
try {
prefs.store();
} catch (IOException ex) {
Logger.getLogger(GuestbookPortlet.class.getName()).log(
Level.SEVERE, null, ex);
} catch (ValidatorException ex) {
Logger.getLogger(GuestbookPortlet.class.getName()).log(
Level.SEVERE, null, ex);
}
} catch (ReadOnlyException ex) {
Logger.getLogger(GuestbookPortlet.class.getName()).log(
Level.SEVERE, null, ex);
}
}
答案 0 :(得分:0)
System.out不是最优雅的调试方式,但它们可以在Liferay中使用。
您确定要阅读 tomcat / logs / catalina.out 文件吗?