Interface InternalLogger

  • All Known Subinterfaces:
    BundleLogger, ComponentLogger, ScrLogger
    All Known Implementing Classes:
    NoOpLogger, ScrLogManager.ScrLoggerFacade

    public interface InternalLogger
    Base interface for the different SCR Loggers. Since this is not used outside this package, it could be private. However, then Level should be standalone, which would change most files. So minimize the code change, it is kept public.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  InternalLogger.Level
      The level to log.
    • Method Detail

      • log

        void log​(InternalLogger.Level level,
                 java.lang.String message,
                 java.lang.Throwable ex)
        Logs the message to an appropriate OSGi logger. If not such logger can be found then it will log to stderr for ERROR & AUDIT messages and stdout for other messages
        Parameters:
        level - only log when this level is implied by the current log level
        message - the message to log
        ex - a Throwable or null
      • log

        void log​(InternalLogger.Level level,
                 java.lang.String message,
                 java.lang.Throwable ex,
                 java.lang.Object... args)
        Formats the message using the MessageFormat class, i.e. with {} place holders for the args. It then calls log(Level, String, Throwable).
        Parameters:
        level - only log when this level is implied by the current log level
        message - the message to log
        ex - a Throwable or null
        args - the arguments to the MessageFormat formatting
      • isLogEnabled

        boolean isLogEnabled​(InternalLogger.Level level)
        Answer true if the current logging level is enabled for the given level. For stdout/stderr fallback the logging level is defined by the LogConfiguration.getLogLevel(). If there is an OSGi logger available then the logger name will define the log level via LoggerAdmin.
        Parameters:
        level - the level to check
        Returns:
        true if the given log level is enabled