Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

For uPortal 3.1 a database persistent PortalEvent logger will be included. The logger will use the same JPA/Hibernate persistence API that other new database facing code in uPortal 3 uses. The event driven portal statistics model introduced in uPortal 2.6 is used which allows new events to be logged by this handler by simply adding the appropriate Hibernate mapping information about the class.

Database Event Logging Concerns

When logging portal events to a database serious considerations need to be made about the amount of available space and the performance of the database. A uPortal database is mostly read oriented with only a few writes when a new user logs in or a user changes their layout. The event log database will be primarily writes and can write a significant amount of data.

  • As an example a user that is in 5 groups logging in results in 1 new row in STATS_SESSION, 5 new rows in STATS_SESSION_GROUPS, and 2 new rows in STATS_EVENTS.

...

  • Another example of a user viewing their default tab with 6 channels for the first time results in: 13 rows in STATS_EVENTS, 12 rows in STATS_CHANNEL, 12 rows in STATS_FOLDER, and 7 rows in STATS_RENDER_TIME. Note that as with any EventHandler the users and events to be logged can be configured in the statsContext.xml file which can reduce the number of events logged to the database.

Event Logging Configuration

TODO:

  • how to enable the logger
  • how to configure which events are logged

The default uPortal configuration has the database event logger disabled. To enable it two files need to be edited.

  1. In uportal-impl/src/main/resources/properties/contexts/statsContext.xml uncomment the <ref bean="queueingEventHandler"/> reference in the portalEventMulticaster bean then scroll down and un-comment the entire bottom section in the file. There are specific instructions for doing so in the file.
  2. In uportal-impl/src/main/resources/properties/contexts/schedulerContext.xml uncomment the <ref bean="statsQueueFlushingTask"/> reference in the timerFactory bean then scroll down and un-comment the statsQueueFlushingTask bean.

To configure which events are logged refer to the JavaDocs for the AbstractLimitedSupportEventHandler. The QueueingEventHandler which sits in front of the persisting bean extends AbstractLimitedSupportEventHandler to event filtering can be configured there.

The QueueingEventHandler is used to batch the persist action for better performance and to reduce database IO. The default configuration is to only store events when there are at least 50 in the queue or every 60 seconds, whichever comes first. This configuration should not need to be changed.

Database Tables

The following tables are used to log portal event information.

...

The Hibernate entity mappings for the logged PortalEvents is done in the file uportal-impl/src/main/resources/properties/db/stats/portalEvents.hbm.xml. If you add a new PortalEvent implementation that should be logged to the database it needs to be mapped correctly in this file. Unmapped PortalEvents are ignored by the database logging code.

Reading Events

The Hibernate entity mappings and PortalEvent classes are not designed to be read from the database using Hibernate, only to be a logging facility. Any reporting tools should just use straight SQL as doing large reporting tasks via ORM is not easy and the PortalEvent object model is not designed for such use.