我在控制台中看不到输出,Liferay 中出现 System.out.println 问题
I don't see output in Console, System.out.println issue in Liferay
我使用 Liferay portlet bundle 6.2 (Tomcat),我在 portlet 首选项中保存了一些变量。它没有问题,但是如果我用 System.out.println
打印条目,它不会在控制台上输出。 Liferay 中 System.out.println
的输出在哪里?我如何在 Liferay 中使用 System.out.println
,是否有其他解决方案而不是 System.out.println
?
按照我post的代码,
谢谢
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);
}
}
System.out 不是最优雅的调试方式,但它们适用于 Liferay。
您确定正在阅读 tomcat/logs/catalina.out 文件吗?
我使用 Liferay portlet bundle 6.2 (Tomcat),我在 portlet 首选项中保存了一些变量。它没有问题,但是如果我用 System.out.println
打印条目,它不会在控制台上输出。 Liferay 中 System.out.println
的输出在哪里?我如何在 Liferay 中使用 System.out.println
,是否有其他解决方案而不是 System.out.println
?
按照我post的代码,
谢谢
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);
}
}
System.out 不是最优雅的调试方式,但它们适用于 Liferay。
您确定正在阅读 tomcat/logs/catalina.out 文件吗?