Configure PTLogger to only capture portlet errors

Portal Server by matt on April 14th, 2008 No Comments

You know how you always ignore all those warnings and errors in PTSpy?  Or how you don’t bother looking at the /ptlogging/logs/portal/portalserver-log.spy file because it’s just filled with so many benign errors that you don’t care about ‘em any more?

The problem with this, of course, is that there may be “real” errors getting lost in that noise.  In fact, one particular type of “real” error isn’t even recorded as an error at all – it’s flagged as a “warning”.  This is the event that gets thrown when a portlet fails to load.  No one’s going to spend all day, every day, clicking through every single community in their portal, looking for broken portlets – and even if portlets are working at the moment for you doesn’t mean they’re not failing at some other time or for some other user.

One solution is to get the PT Logger service to create a log file dedicated solely to recording portlet failures, that you can parse or review at any time to identify trends.  The trick is to edit the ptLogger.xml file (in /bea/alui/settings/ptlogging/ptLogger.xml) to register a new appender for the portletfailure-log.spy file, then setting the component parameters appropriately to record only portlet failure events (which are warnings on the PortletProvider component):

<appender class=”org.apache.log4j.DailyRollingFileAppender name=”PortletFailureLogFile“>

  <layout class=”com.plumtree.openlog.log4jbridge.MyPatternLayout” />

  <param name=”File value=”portal/portletfailure-log.spy” />

  <param name=”Append value=”true” />

        <param name=”DatePattern value=”‘.’yyyy-ww” />

  </appender>

<filters appender=”PortletFailureLogFile server=”portal.portalserver.mchiste“>

<component-defaults>

  <level enabled=”false value=”Debug” />

  <level enabled=”false value=”Info” />

  <level enabled=”false value=”Warning” />

  <level enabled=”false value=”Error” />

  <level enabled=”false value=”Fatal” />

  <level enabled=”false value=”Action” />

  <level enabled=”false value=”Performance” />

  <level enabled=”false value=”Function” />

  </component-defaults>

<component name=”PortletProvider“>

  <level enabled=”false value=”Debug” />

  <level enabled=”false value=”Info” />

  <level enabled=”true value=”Warning” />

  <level enabled=”true value=”Error” />

  <level enabled=”true value=”Fatal” />

  <level enabled=”false value=”Action” />

  <level enabled=”false value=”Performance” />

  <level enabled=”false value=”Function” />

  </component>

  </filters>

Remember, you can configure all kinds of appenders to do different things with these events, and you can use this method to isolate any kind of event you want to in its own dedicated file.

You can even prevent events from being recorded to the portal log.  Say you’re getting one type of error (i.e., a bad adaptive tag) thrown over and over with every page load, which is creating huge log files and concealing other more important events.  Obviously, you should try to fix the root cause, but to hide the error, just add a <component> section to the PortalDailyLogFile appender and set all logging levels to false. Other events will still be logged based on the component-default section, but you’ve now overridden the problematic component so it won’t log at all.

portlet-fail.jpg

 

Check out the docs for more details!

No Responses to “Configure PTLogger to only capture portlet errors”

Leave a Reply

You must be logged in to post a comment.