Log4J Configurations for ALUI Portal and Components

Development by matt on August 17th, 2007 No Comments

Logging is an important part of portal diagnostics. In addition to using PTSpy for real-time diagnostics, the ALUI portal now ships with a Plumtree Logger service that can capture events and record them to a file. The great thing about this service is that it uses log4j to configure how and what events are recorded.

Unfortunately, in many cases the default logging configuration isn’t adequate. The default logging for the portal is to roll over daily, and in some cases with heavily used portals this can cause the log files to exceed hundreds of megs a day, which means you can’t even open them in PTSpy to view all the information. The good news is that log4j is easy to configure – instead of using a “DailyRollingFileAppender”, you can use a standard “RollingFileAppender”. This allows the logging to roll over when the file hits a certain size, not just once per day. That way, you can configure the logging service to maintain a finite set of logs with a managable size.

To configure this, open %PORTAL_HOME%\plumtree\settings\ptlogging\ptLogger.xml. Study the file to see how the various appenders and filters are configured, and follow these steps:


  1. Change the name and class of the PortalDailyLogFile appender:

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

    to:

              <appender class=”org.apache.log4j.RollingFileAppender” name=”PortalRollingLogFile”>
  2. Change the filter to use this appender:

              <filters appender=”PortalDailyLogFile” server=”portal.nas-vm.Administrator”>

    to:

              <filters appender=”PortalRollingLogFile” server=”portal.nas-vm.Administrator”>

  3. Remove the “DatePattern” parameter (we’re not going be rolling over based on date, just size):

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

  4. Change the “Append” parameter to “true” so that the logs aren’t overwritten when the service PT Logger Service is restarted:

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

    to:

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

  5. Add the following lines to the appender to determine how big the file should be before it’s rolled over, and how many files to keep at any time:

              <param name=”MaxFileSize” value=”50MB”/>

              <param name=”MaxBackupIndex” value=”10″/>

  6. Restart the PT Logger Service. The new logs will be recorded to %PORTAL_HOME%\ptlogging\logs\portal\.


Log4j Configuration

Remember these are all standard log4j configurations, so you could change the layout of the logging, log to a database, even set up logging to email you when fatal errors occur.

No Responses to “Log4J Configurations for ALUI Portal and Components”

Leave a Reply

You must be logged in to post a comment.