Class EventLog

java.lang.Object
edu.ucsb.nceas.metacat.EventLog

public class EventLog extends Object
EventLog is used to initialize 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 permanent 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
  • Field Details

  • Method Details

    • refreshLogProperties

      public void refreshLogProperties()
      Refresh the class fields controlled by properties
    • 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(String ipAddress, String userAgent, String principal, String docid, 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
      userAgent - the agent making the request
      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 String getReport(String[] ipAddress, String[] principal, String[] docid, String[] event, Timestamp startDate, Timestamp endDate, boolean anonymous)
      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
    • isDeleted

      public boolean isDeleted(String docid)
      A utility method to determine if the given docid was deleted.
      Parameters:
      docid - the specified docid
      Returns:
      true if there is a delete event for the id; false otherwise.
    • getD1Report

      public org.dataone.service.types.v2.Log getD1Report(String[] ipAddress, String[] principal, String[] docid, String event, Timestamp startDate, Timestamp endDate, boolean anonymous, Integer start, Integer count)