Interface LogReaderService
-
@ProviderType public interface LogReaderService
LogReaderService for obtaining logging information.Since 1.4,
LogStreamProvider
is the preferred way to obtainLogEntry
objects.The LogReaderService provides two ways to obtain
LogEntry
objects:- The primary way to retrieve
LogEntry
objects is to register aLogListener
object whoseLogListener.logged(LogEntry)
method will be called for each entry added to the log. - To obtain past
LogEntry
objects, thegetLog()
method can be called which will return anEnumeration
of theLogEntry
objects in the log.
- The primary way to retrieve
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addLogListener(LogListener listener)
Subscribes toLogEntry
objects.java.util.Enumeration<LogEntry>
getLog()
Returns anEnumeration
of theLogEntry
objects in the log.void
removeLogListener(LogListener listener)
Unsubscribes toLogEntry
objects.
-
-
-
Method Detail
-
addLogListener
void addLogListener(LogListener listener)
Subscribes toLogEntry
objects.This method registers a
LogListener
object with the Log Reader Service. TheLogListener.logged(LogEntry)
method will be called for eachLogEntry
object placed into the log.When a bundle which registers a
LogListener
object 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
l
such that(l==listener)
, this method does nothing.Since 1.4,
LogStreamProvider
is the preferred way to obtainLogEntry
objects.- Parameters:
listener
- ALogListener
object to register; theLogListener
object is used to receiveLogEntry
objects.
-
removeLogListener
void removeLogListener(LogListener listener)
Unsubscribes toLogEntry
objects.This method unregisters a
LogListener
object from the Log Reader Service.If
listener
is not contained in this Log Reader Service's list of listeners, this method does nothing.Since 1.4,
LogStreamProvider
is the preferred way to obtainLogEntry
objects.- Parameters:
listener
- ALogListener
object to unregister.
-
getLog
java.util.Enumeration<LogEntry> getLog()
Returns anEnumeration
of theLogEntry
objects in the log.Each element of the enumeration is a
LogEntry
object, ordered with the most recent entry first. Whether the enumeration is of allLogEntry
objects since the Log Service was started or some recent past is implementation-specific.- Returns:
- An
Enumeration
of theLogEntry
objects in the log.
-
-