Class ScrLogManager

  • All Implemented Interfaces:
    java.util.EventListener, org.osgi.framework.BundleListener, org.osgi.util.tracker.ServiceTrackerCustomizer<java.lang.Object,​java.lang.Object>
    Direct Known Subclasses:
    ExtLogManager

    public class ScrLogManager
    extends LogManager
    Implements a SCR based log manager. This class was needed to not change the whole codebase. It looks very similar to the old logging but leverages the LogManager. This class implements the existing behavior and the ExtLogManager implements the extension behavior. The scr() method makes this distinction based on the configuration.
    • Field Detail

      • bundle

        private final org.osgi.framework.Bundle bundle
    • Constructor Detail

      • ScrLogManager

        ScrLogManager​(org.osgi.framework.BundleContext context,
                      LogConfiguration config)
    • Method Detail

      • scr

        public ScrLogger scr()
        This logger is used for the main code of SCR. This will use the SCR bundle & the Logger.ROOT_LOGGER_NAME
        Returns:
        scr logger.
      • bundle

        public BundleLogger bundle​(org.osgi.framework.Bundle bundle)
        This logger is used for the logging on a per bundle basis. This will use the target bundle & the Logger.ROOT_LOGGER_NAME
        Parameters:
        bundle - the target bundle
        Returns:
        a logger suitable to log bundle entries
      • component

        public ComponentLogger component​(org.osgi.framework.Bundle bundle,
                                         java.lang.String implementationClass,
                                         java.lang.String name)
        This logger is used for the logging on a per bundle basis. This will use the target bundle & the implementation class as logger name.
        Parameters:
        bundle - the target bundle
        Returns:
        a logger suitable to log bundle entries
      • getBundleIdentifier

        java.lang.String getBundleIdentifier​(org.osgi.framework.Bundle bundle)
      • format

        java.lang.String format​(java.lang.String pattern,
                                java.lang.Object... arguments)