Blogroll

The New Domino Admin

A great source of information for Lotus Domino administrators

ecmarchitect.com

Jeff Potts' excellent ECM/Portal blog

Jared Ottley

Lots of very useful Alfresco articles

Looking for web hosting?  I have been using DreamHost for years and have found them to be reliable, inexpensive and very good at what they do!  Click below to sign up, use promo code 'unorganized' to get a free domain registration and 10 bucks off your first year of hosting!

 

dreamhostBadge

Home Software and Tech Software Development Liferay Portal - Log Levels for Third Party Portlets
Liferay Portal - Log Levels for Third Party Portlets PDF Print E-mail
Written by Nathan McMinn   
Monday, 07 June 2010 10:26

If you are developing your own portlets for Liferay, you have surely noticed that your portlet log statements don't show up in the logs by default.  Or, like me, you may have moved a portlet from test to production only to have it fail.  When you are running with a debugger attached, it's a simple matter to set a breakpoint and see where things are going wrong.  On a production server, this isn't really an option.  You need detailed, fine-grained control over your log configuration.  Liferay can output logging as detailed as you want, class by class or package by package.  These can either be set using portal-log4j.xml, an extension file or (my preference), the server administration console.  Changes made via the administrative interface can be applied immediately, without a server restart, making it the best choice for troubleshooting in a live environment.

 

To get started, open the main portal menu and select "Control Panel".  At the bottom of the left side menu there is a "Server Administration" option which takes you to the following screen:

 

 

At the top of this page is a "Log Levels" option.  This tab allows the user to set the log level for various classes and packages.  Each "category" can consist of either a package name (at any level) or even a specific class.

 

 

To enable logging for a specific custom portlet, click the "Add Category" tab.

 

In the text box, enter the package name of your portlet class.  In this example I am using the package "com.um", which is the base package for the Alfresco Web Script Portlet.  This will turn on logging for any classes that reside in the package hierarchy beginning with "com.um", including the main portlet class com.um.portlets.alfresco.WebscriptPortlet and the proxy servlet class com.um.portlets.alfresco.servlets.ProxyServlet.  Next, select your log level.  These correspond with the log levels defined by Log4j.  Click "Save" to create the new category and apply the change.

 

 

Once the category is saved, it can be seen in the category list.  From this list you can adjust the log level.  When you are done debugging, go back in and set it to "Info" or another category.

 

More info on this topic can be found in the Liferay Wiki.

Last Updated on Monday, 07 June 2010 11:39
 
RSS Feed Icon

About Me

 

My profile picture

 

My name is Nathan McMinn.  I'm a software engineer, beer geek, wannabe adventurer and genuinely curious guy.  Find me on Facebook, Linkedin or Twitter

Latest Comments