Class BundleLogger


  • public class BundleLogger
    extends LogServiceEnabledLogger
    The BundleLogger defines a simple API to enable some logging on behalf of an extended bundle. This avoids that all clients doing logging on behalf of a component bundle need to pass in things like BundleContext.
    • Constructor Detail

      • BundleLogger

        public BundleLogger​(org.osgi.framework.BundleContext bundleContext,
                            ScrLogger parent)
    • Method Detail

      • getTrackingCount

        int getTrackingCount()
      • log

        public boolean log​(int level,
                           java.lang.String pattern,
                           java.lang.Throwable ex,
                           java.lang.Object... arguments)
        Description copied from class: AbstractLogger
        Method to actually emit the log message. If the LogService is available, the message will be logged through the LogService. Otherwise the message is logged to stdout (or stderr in case of LOG_ERROR level messages),
        Overrides:
        log in class AbstractLogger
        Parameters:
        level - The log level to log the message at
        pattern - The java.text.MessageFormat message format string for preparing the message
        ex - An optional Throwable whose stack trace is written,
        arguments - The format arguments for the pattern string.
      • log

        public boolean log​(int level,
                           java.lang.String message,
                           java.lang.Throwable ex)
        Description copied from class: AbstractLogger
        Method to actually emit the log message. If the LogService is available, the message will be logged through the LogService. Otherwise the message is logged to stdout (or stderr in case of LOG_ERROR level messages),
        Overrides:
        log in class AbstractLogger
        Parameters:
        level - The log level of the messages. This corresponds to the log levels defined by the OSGi LogService.
        message - The message to print
        ex - The Throwable causing the message to be logged.