Package edu.ucsb.nceas.metacat
Class EventLog
java.lang.Object
edu.ucsb.nceas.metacat.EventLog
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.dataone.service.types.v2.Log
getD1Report
(String[] ipAddress, String[] principal, String[] docid, String event, Timestamp startDate, Timestamp endDate, boolean anonymous, Integer start, Integer count) static EventLog
Return the single instance of the event log after initializing it if it wasn't previously initialized.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.boolean
A utility method to determine if the given docid was deleted.void
Log an event of interest to the application.void
Refresh the class fields controlled by properties
-
Field Details
-
DELETE
- See Also:
-
-
Method Details
-
refreshLogProperties
public void refreshLogProperties()Refresh the class fields controlled by properties -
getInstance
Return the single instance of the event log after initializing it if it wasn't previously initialized.- Returns:
- the single EventLog instance
-
log
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 eventuserAgent
- the agent making the requestprincipal
- the principal for the event (a username, etc)docid
- the identifier of the document to which the event appliesevent
- 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 eventprincipal
- the principal for the event (a username, etc)docid
- the identifier of the document to which the event appliesevent
- the string code for the eventstartDate
- beginning of date range for queryendDate
- end of date range for query- Returns:
- an XML-formatted report of the access log entries
-
isDeleted
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
-