Interface LogReaderService
-
@ProviderType public interface LogReaderServiceLogReaderService for obtaining logging information.Since 1.4,
LogStreamProvideris the preferred way to obtainLogEntryobjects.The LogReaderService provides two ways to obtain
LogEntryobjects:- The primary way to retrieve
LogEntryobjects is to register aLogListenerobject whoseLogListener.logged(LogEntry)method will be called for each entry added to the log. - To obtain past
LogEntryobjects, thegetLog()method can be called which will return anEnumerationof theLogEntryobjects in the log.
- The primary way to retrieve
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddLogListener(LogListener listener)Subscribes toLogEntryobjects.java.util.Enumeration<LogEntry>getLog()Returns anEnumerationof theLogEntryobjects in the log.voidremoveLogListener(LogListener listener)Unsubscribes toLogEntryobjects.
-
-
-
Method Detail
-
addLogListener
void addLogListener(LogListener listener)
Subscribes toLogEntryobjects.This method registers a
LogListenerobject with the Log Reader Service. TheLogListener.logged(LogEntry)method will be called for eachLogEntryobject placed into the log.When a bundle which registers a
LogListenerobject is stopped or otherwise releases the Log Reader Service, the Log Reader Service must remove all of the bundle's listeners.If this Log Reader Service's list of listeners already contains a listener
lsuch that(l==listener), this method does nothing.Since 1.4,
LogStreamProvideris the preferred way to obtainLogEntryobjects.- Parameters:
listener- ALogListenerobject to register; theLogListenerobject is used to receiveLogEntryobjects.
-
removeLogListener
void removeLogListener(LogListener listener)
Unsubscribes toLogEntryobjects.This method unregisters a
LogListenerobject from the Log Reader Service.If
listeneris not contained in this Log Reader Service's list of listeners, this method does nothing.Since 1.4,
LogStreamProvideris the preferred way to obtainLogEntryobjects.- Parameters:
listener- ALogListenerobject to unregister.
-
getLog
java.util.Enumeration<LogEntry> getLog()
Returns anEnumerationof theLogEntryobjects in the log.Each element of the enumeration is a
LogEntryobject, ordered with the most recent entry first. Whether the enumeration is of allLogEntryobjects since the Log Service was started or some recent past is implementation-specific.- Returns:
- An
Enumerationof theLogEntryobjects in the log.
-
-