ShowTable of Contents
This article is one in a collection of articles and samples that illustrate techniques for developing with Portlet Factory. See the WebSphere Portlet Factory product documentation
for a complete list of these. For an introduction to developing with Portlet Factory, complete the introductory tutorials that are available both in the product help and on that web site.
You should have a basic familiarity with Portlet Factory and be able to create and run Portlet Factory models. A basic understanding of Portlet Factory Profiling is also required.
As of WebSphere Portlet Factory 6.1.5 it is now possible to remotely deploy a development project using the designer. Previous versions required manual deployment, as well as a mapped drive for pushing project changes through. With the new JMX deployment scenario, a mapped drive is no longer necessary, although it does speed up file copying. If a mapped drive is not available, it may quite difficult to remotely access the portlet factory log files.
The Log Monitor tool was written with this problem in mind. The system runs as a standalone model, which scans the log files, and serves up the results as RSS feeds. Each feed is an individual log file, which may be enabled or disabled via a property file. During a request to the Log Monitor model, the log files are polled for changes, and any updates are passed through as new RSS entries. Each RSS entry will contain a predefined section of a log file, along with a timestamp. The default value is set to 10 seconds, so timestamps within 5 seconds of eachother will be grouped into a single rss entry.
The utility model also offers a page to displays current active rss feed urls, and a download link that will send a zipfile of the project logs.
The following items are key parts to the sample which will be accessed or modified.
Table 1. Sample package contents (relative to WEB-INF)
- LogMonitor.model. This is the main entry point for the log monitor utility. The model should be accessed via a standalone url, and cannot function as a portlet. Once the model is ran, a list of active RSS feed urls will be generated, as well as a link that will stream the contents of the log folder as a zip file.
- LogMonitor.config Main configuration file for the log monitor utility. This contains several inputs that can be used to change the behavior of the tool. A webapp restart will be required for most changes to take effect.
- AggregateInterval This property is used to specify the snapshot size (in seconds) for a given RSS entry. The default value is set to 10 seconds. This will aggregate 10 seconds of log entries (as defined in their timestamp) into a single RSS entry.
- MaxEntriesPerChannel Defines the maximum number of RSS entries per feed. Older feeds are removed from the list as new ones are added. This value defaults to 25.
- EnabledLogs This property takes a comma-delimited list of log files that will be monitored by the tool. This does not affect the files that will be returned in the log download link. Defaults to general.txt,event.log,serverStats.txt
- ItemLabelDateFormat This property is used to specify the display date format for RSS entries. Defaults to yyyy-MMM-dd hh:mm:ss
|Filename and location||Description|
|Log utility model. Run this model to receive RSS feed links.|
|Properties file that exposes configuration settings to the user.|
|Jar containing utility classes for LogMonitor|
Instructions for running the sample
To run the sample application:
- Create a project or use an existing project.
- Download the sample ZIP file and import it into the project using File > Import > WebSphere Portlet Factory Archive command.
- Open one of the models found in
and run it. This models will run out-of-box without any configuration required.
This tool is currently released as a sample, and therefore has not been tested widely in development environments yet. Improvements will be made over time to the Log monitor. This tool is also limited to standalone execution. The model cannot run as a portlet, and the RSS feed links will not work properly.
WebSphere Portlet Factory product documentation
WebSphere Portlet Factory support