edu.ucsb.nceas.metacat
Class EventLog

java.lang.Object
  extended byedu.ucsb.nceas.metacat.EventLog

public class EventLog
extends java.lang.Object

EventLog is used to intialize and store a log of events that occur in an application. The events are registered with the logger as they occur, but EventLog writes them to permenant storage when it is most convenient or efficient. EventLog is a Singleton as there should always be only one object for these logging events. TODO: Logging to the database needn't be synchronous with the event. Instead, a separate thread can be launched that periodically sleeps and only wakes periodically to see if metacat is idle. The log event can be cached and inserted later when the thread wakes and finds metacat idle. TODO: Write a function that archives a part of the log table to an external text file so that the log table doesn't get to big. This function should be able to be called manually or on a schedule. TODO: Write an access function that returns an XML report for a specific subset of events. Users should be able to query on principal, docid/rev, date, event, and possibly other fields.

Author:
jones

Method Summary
static EventLog getInstance()
          Return the single instance of the event log after initializing it if it wasn't previously initialized.
 java.lang.String getReport(java.lang.String[] ipAddress, java.lang.String[] principal, java.lang.String[] docid, java.lang.String[] event, java.sql.Timestamp startDate, java.sql.Timestamp endDate)
          Get a report of the log events that match a set of filters.
 void log(java.lang.String ipAddress, java.lang.String principal, java.lang.String docid, java.lang.String event)
          Log an event of interest to the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EventLog getInstance()
Return the single instance of the event log after initializing it if it wasn't previously initialized.

Returns:
the single EventLog instance

log

public void log(java.lang.String ipAddress,
                java.lang.String principal,
                java.lang.String docid,
                java.lang.String event)
Log an event of interest to the application. The information logged can include basic identification information about the principal or computer that initiated the event.

Parameters:
ipAddress - the internet protocol address for the event
principal - the principal for the event (a username, etc)
docid - the identifier of the document to which the event applies
event - the string code for the event

getReport

public java.lang.String getReport(java.lang.String[] ipAddress,
                                  java.lang.String[] principal,
                                  java.lang.String[] docid,
                                  java.lang.String[] event,
                                  java.sql.Timestamp startDate,
                                  java.sql.Timestamp endDate)
Get a report of the log events that match a set of filters. The filter parameters can be null; log records are subset based on non-null filter parameters.

Parameters:
ipAddress - the internet protocol address for the event
principal - the principal for the event (a username, etc)
docid - the identifier of the document to which the event applies
event - the string code for the event
startDate - beginning of date range for query
endDate - end of date range for query
Returns:
an XML-formatted report of the access log entries


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.