Adding logging to portlet code is usually an afterthought during the
development cycle. The issue of logging usually only comes up after a portlet
has been deployed in production and an error occurs. Then you hear, "Well,
the problem didn't happen during testing."
This paper steps you through the three different logging mechanisms available
for portlets. The first demonstrates the WebSphere Portal's built-in logging
mechanism. The second is a roll-your-own version of the base WebSphere Portal
logging. The third shows you how to add Log4j to your portlet.
Add WebSphere PortletLog to a Basic Portlet
Start by creating a basic portlet using the IBM Rational Software Development
Platform. All of the examples in this article should be run in the J2EE
perspective. Using the navi... (more)