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.
  • Method Details

    • log

      void log(InternalLogger.Level level, String message, 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 invalid input: '&' 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, String message, Throwable ex, 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