|
Operating systems: i5/OS, Linux,Windows |
Portlets can write message and trace information to log files, which are maintained in the PortalServer_root/log/ directory. The log files help the portal administrator investigate portlet errors and special conditions and help the portlet developer test and debug portlets.
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException{
PortletContext context = getPortletContext();
try{
String save = request.getParameter("save");
if (save != null){
PortletPreferences prefs = request.getPreferences();
prefs.setValue("userName",request.getParameter("username"));
prefs.store();
}
}
catch ( IOException ioe ){
context.log("An IO error occurred when trying to save the name.");
}
catch ( PortletException pe ) {
context.log("A portlet exception was thrown when trying to save the name.");
}
}
private PortletLog myLogRef = getPortletLog();
if( getPortletLog().isDebugEnabled() )
{
myLogRef.debug("Warning, Portlet Resources are low!");
}
See WebSphere Portal Express run-time logs for a description of how trace strings are set in the log.properties file.