Interface LogEntry


  • @ProviderType
    public interface LogEntry
    Provides methods to access the information contained in an individual Log Service log entry.

    A LogEntry object may be acquired from the LogReaderService.getLog method or by registering a LogListener object.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      org.osgi.framework.Bundle getBundle()
      Returns the bundle that created this LogEntry object.
      java.lang.Throwable getException()
      Returns the exception object associated with this LogEntry object.
      int getLevel()
      Deprecated.
      Since 1.4.
      default java.lang.StackTraceElement getLocation()
      Returns the location information of the creation of this LogEntry object.
      default java.lang.String getLoggerName()
      Returns the name of the Logger object used to create this LogEntry object.
      default LogLevel getLogLevel()
      Returns the level of this LogEntry object.
      java.lang.String getMessage()
      Returns the formatted message associated with this LogEntry object.
      default long getSequence()
      Returns the sequence number for this LogEntry object.
      org.osgi.framework.ServiceReference<?> getServiceReference()
      Returns the ServiceReference object for the service associated with this LogEntry object.
      default java.lang.String getThreadInfo()
      Returns a string representing the thread which created this LogEntry object.
      long getTime()
      Returns the value of currentTimeMillis() at the time this LogEntry object was created.
    • Method Detail

      • getBundle

        org.osgi.framework.Bundle getBundle()
        Returns the bundle that created this LogEntry object.
        Returns:
        The bundle that created this LogEntry object; null if no bundle is associated with this LogEntry object.
      • getServiceReference

        org.osgi.framework.ServiceReference<?> getServiceReference()
        Returns the ServiceReference object for the service associated with this LogEntry object.
        Returns:
        ServiceReference object for the service associated with this LogEntry object; null if no ServiceReference object was provided.
      • getLevel

        @Deprecated
        int getLevel()
        Deprecated.
        Since 1.4. Replaced by getLogLevel().
        Returns the integer level of this LogEntry object.

        If one of the log methods of LogService was used, this is the specified integer level. Otherwise, this is the ordinal value of the log level.

        Returns:
        Integer level of this LogEntry object.
      • getMessage

        java.lang.String getMessage()
        Returns the formatted message associated with this LogEntry object.
        Returns:
        String containing the formatted message associated with this LogEntry object.
      • getException

        java.lang.Throwable getException()
        Returns the exception object associated with this LogEntry object.

        In some implementations, 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 collected, the Log Service may return an exception object of an implementation defined Throwable subclass. The returned object will attempt to provide as much information as possible from the original exception object such as the message and stack trace.

        Returns:
        Throwable object of the exception associated with this LogEntry;null if no exception is associated with this LogEntry object.
      • getTime

        long getTime()
        Returns the value of currentTimeMillis() at the time this LogEntry object was created.
        Returns:
        The system time in milliseconds when this LogEntry object was created.
        See Also:
        "System.currentTimeMillis()"
      • getLogLevel

        default LogLevel getLogLevel()
        Returns the level of this LogEntry object.
        Returns:
        The level of this LogEntry object.
        Since:
        1.4
      • getLoggerName

        default java.lang.String getLoggerName()
        Returns the name of the Logger object used to create this LogEntry object.
        Returns:
        The name of the Logger object used to create this LogEntry object.
        Since:
        1.4
      • getSequence

        default long getSequence()
        Returns the sequence number for this LogEntry object.

        A unique, non-negative value that is larger than all previously assigned values since the log implementation was started. These values are transient and are reused upon restart of the log implementation.

        Returns:
        The sequence number for this LogEntry object.
        Since:
        1.4
      • getThreadInfo

        default java.lang.String getThreadInfo()
        Returns a string representing the thread which created this LogEntry object.

        This string must contain the name of the thread and may contain other information about the thread.

        Returns:
        A string representing the thread which created this LogEntry object.
        Since:
        1.4
      • getLocation

        default java.lang.StackTraceElement getLocation()
        Returns the location information of the creation of this LogEntry object.
        Returns:
        The location information of the creation of this LogEntry object.
        Since:
        1.4