Log Entry Interface Log Service Specification Version 1.3
Page 8 OSGi Service Platform Release 4, Version 4.3
101.5 Log Entry Interface
The LogEntry interface abstracts a log entry. It is a record of the information that was passed when an
event was logged, and consists of a superset of information which can be passed through the
LogService methods. The LogEntry interface defines these methods to retrieve information related
to LogEntry objects:
• getBundle() – This method returns the Bundle object related to a LogEntry object.
• getException() – This method returns the exception related to a LogEntry object. In some imple-
mentations, the returned exception may not be the original exception. To avoid references to a
bundle defined exception class, thus preventing an uninstalled bundle from being garbage col-
lected, the Log Service may return an exception object of an implementation defined Throwable
subclass. This object will attempt to return as much information as possible, such as the message
and stack trace, from the original exception object .
• getLevel() – This method returns the severity level related to a LogEntry object.
• getMessage() – This method returns the message related to a LogEntry object.
• getServiceReference() –This method returns the ServiceReference object of the service related to
a LogEntry object.
• getTime() – This method returns the time that the log entry was created.
101.6 Mapping of Events
Implementations of a Log Service must log Framework-generated events and map the information to
LogEntry objects in a consistent way. Framework events must be treated exactly the same as other
logged events and distributed to all LogListener objects that are associated with the Log Reader Ser-
vice. The following sections define the mapping for the three different event types: Bundle, Service,
and Framework.
101.6.1 Bundle Events Mapping
A Bundle Event is mapped to a LogEntry object according to Table 101.2, “Mapping of Bundle Events
to Log Entries,” on page 8.
Table 101.2 Mapping of Bundle Events to Log Entries
Log Entry method Information about Bundle Event
getLevel() LOG_INFO
getBundle() Identifies the bundle to which the event happened. In other words, it
identifies the bundle that was installed, started, stopped, updated, or
uninstalled. This identification is obtained by calling getBundle()
on the BundleEvent object.
getException() null
getServiceReference() null
getMessage() The message depends on the event type:
• INSTALLED – "BundleEvent INSTALLED"
• STARTED – "BundleEvent STARTED"
• STOPPED – "BundleEvent STOPPED"
• UPDATED – "BundleEvent UPDATED"
• UNINSTALLED – "BundleEvent UNINSTALLED"
• RESOLVED – "BundleEvent RESOLVED"
• UNRESOLVED – "BundleEvent UNRESOLVED"