@ProviderType
public interface LogReaderService
Since 1.4, org.osgi.service.log.stream.LogStreamProvider
is the
preferred way to obtain LogEntry
objects.
The LogReaderService provides two ways to obtain LogEntry
objects:
LogEntry
objects is to register a
LogListener
object whose LogListener.logged(LogEntry)
method
will be called for each entry added to the log.LogEntry
objects, the getLog()
method can
be called which will return an Enumeration
of the LogEntry
objects in the log.Modifier and Type | Method and Description |
---|---|
void |
addLogListener(LogListener listener)
Subscribes to
LogEntry objects. |
java.util.Enumeration<LogEntry> |
getLog()
Returns an
Enumeration of the LogEntry objects in the
log. |
void |
removeLogListener(LogListener listener)
Unsubscribes to
LogEntry objects. |
void addLogListener(LogListener listener)
LogEntry
objects.
This method registers a LogListener
object with the Log Reader
Service. The LogListener.logged(LogEntry)
method will be called
for each LogEntry
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, org.osgi.service.log.stream.LogStreamProvider
is the
preferred way to obtain LogEntry
objects.
listener
- A LogListener
object to register; the
LogListener
object is used to receive LogEntry
objects.void removeLogListener(LogListener listener)
LogEntry
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, org.osgi.service.log.stream.LogStreamProvider
is the
preferred way to obtain LogEntry
objects.
listener
- A LogListener
object to unregister.java.util.Enumeration<LogEntry> getLog()
Enumeration
of the LogEntry
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 all
LogEntry
objects since the Log Service was started or some recent
past is implementation-specific.
Enumeration
of the LogEntry
objects in the
log.Copyright © OSGi Alliance (2000, 2020). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0