Class AbstractLogger

java.lang.Object
org.apache.felix.scr.impl.logger.AbstractLogger
Direct Known Subclasses:
ComponentLogger, LogServiceEnabledLogger

public abstract class AbstractLogger extends Object
This is a common base for all loggers
  • Field Details

    • config

      private final ScrConfiguration config
    • prefix

      private volatile String prefix
      The prefix put for each log message
  • Constructor Details

  • Method Details

    • getConfiguration

      ScrConfiguration getConfiguration()
    • setPrefix

      void setPrefix(String value)
    • getPrefix

      String getPrefix()
    • getLogger

      abstract InternalLogger getLogger()
      Get the internal logger
      Returns:
      The internal logger
    • isLogEnabled

      public boolean isLogEnabled(int level)
      Returns true if logging for the given level is enabled.
    • log

      public boolean log(int level, String pattern, Throwable ex, Object... arguments)
      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),
      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, String message, Throwable ex)
      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),
      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.
    • getBundleIdentifier

      static String getBundleIdentifier(org.osgi.framework.Bundle bundle)
    • format

      private String format(String pattern, Object... arguments)