Class Logger

java.lang.Object
io.airlift.log.Logger

public class Logger extends Object
  • Method Details

    • get

      public static Logger get(Class<?> clazz)
      Gets a logger named after a class' fully qualified name.
      Parameters:
      clazz - the class
      Returns:
      the named logger
    • get

      public static Logger get(String name)
      Gets a named logger
      Parameters:
      name - the name of the logger
      Returns:
      the named logger
    • debug

      public void debug(Throwable exception, String message)
      Logs a message at DEBUG level.
      Parameters:
      exception - an exception associated with the debug message being logged
      message - a literal message to log
    • debug

      public void debug(String message)
      Logs a message at DEBUG level.
      Parameters:
      message - a literal message to log
    • debug

      @FormatMethod public void debug(String format, Object... args)
      Logs a message at DEBUG level.

      Usage example:

          logger.debug("value is %s (%d ms)", value, time);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      format - a format string compatible with String.format()
      args - arguments for the format string
    • debug

      @FormatMethod public void debug(Throwable exception, String format, Object... args)
      Logs a message at DEBUG level.

      Usage example:

          logger.debug(e, "value is %s (%d ms)", value, time);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      exception - an exception associated with the debug message being logged
      format - a format string compatible with String.format()
      args - arguments for the format string
    • info

      public void info(String message)
      Logs a message at INFO level.
      Parameters:
      message - a literal message to log
    • info

      @FormatMethod public void info(String format, Object... args)
      Logs a message at INFO level.

      Usage example:

          logger.info("value is %s (%d ms)", value, time);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      format - a format string compatible with String.format()
      args - arguments for the format string
    • warn

      public void warn(Throwable exception, String message)
      Logs a message at WARN level.
      Parameters:
      exception - an exception associated with the warning being logged
      message - a literal message to log
    • warn

      public void warn(String message)
      Logs a message at WARN level.
      Parameters:
      message - a literal message to log
    • warn

      @FormatMethod public void warn(Throwable exception, String format, Object... args)
      Logs a message at WARN level.

      Usage example:

          logger.warn(e, "something bad happened when connecting to %s:%d", host, port);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      exception - an exception associated with the warning being logged
      format - a format string compatible with String.format()
      args - arguments for the format string
    • warn

      @FormatMethod public void warn(String format, Object... args)
      Logs a message at WARN level.

      Usage example:

          logger.warn("something bad happened when connecting to %s:%d", host, port);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      format - a format string compatible with String.format()
      args - arguments for the format string
    • error

      public void error(Throwable exception, String message)
      Logs a message at ERROR level.
      Parameters:
      exception - an exception associated with the error being logged
      message - a literal message to log
    • error

      public void error(String message)
      Logs a message at ERROR level.
      Parameters:
      message - a literal message to log
    • error

      @FormatMethod public void error(Throwable exception, String format, Object... args)
      Logs a message at ERROR level.

      Usage example:

          logger.error(e, "something really bad happened when connecting to %s:%d", host, port);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      exception - an exception associated with the error being logged
      format - a format string compatible with String.format()
      args - arguments for the format string
    • error

      public void error(Throwable exception)
      Logs a message at ERROR level. The value of exception.getMessage() will be used as the log message.

      Usage example:

          logger.error(e);
       
      Parameters:
      exception - an exception associated with the error being logged
    • error

      @FormatMethod public void error(String format, Object... args)
      Logs a message at ERROR level.

      Usage example:

          logger.error("something really bad happened when connecting to %s:%d", host, port);
       
      If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
      Parameters:
      format - a format string compatible with String.format()
      args - arguments for the format string
    • isDebugEnabled

      public boolean isDebugEnabled()
    • isInfoEnabled

      public boolean isInfoEnabled()