Interface FormatterLogger

  • All Superinterfaces:
    Logger

    @ProviderType
    public interface FormatterLogger
    extends Logger
    Provides methods for bundles to write messages to the log using printf-style format strings.

    Messages can be formatted by the Logger once the Logger determines the log level is enabled. Uses printf-style format strings as described in Formatter.

    You can also add a Throwable and/or ServiceReference to the generated LogEntry by passing them to the logging methods as additional arguments. If the last argument is a Throwable or ServiceReference, it is added to the generated LogEntry and then if the next to last argument is a ServiceReference or Throwable and not the same type as the last argument, it is also added to the generated LogEntry. These arguments will not be used as message arguments. For example:

     logger.info("Found service %s.", serviceReference, serviceReference);
     logger.warn("Something named %s happened.", name, serviceReference,
                    throwable);
     logger.error("Failed.", exception);
     

    If an exception occurs formatting the message, the logged message will indicate the formatting failure including the format string and the arguments.

    Since:
    1.4