Class CalciteLogger

java.lang.Object
org.apache.calcite.util.trace.CalciteLogger

public class CalciteLogger extends Object
Small extension to Logger with some performance improvements.

Logger.info(String format, Object[] params) is expensive to call, since the caller must always allocate and fill in the array params, even when the level will prevent a message being logged. On the other hand, Logger.info(String msg) and Logger.info(String msg, Object o) do not have this problem.

As a workaround this class provides info(String msg, Object o1, Object o2) etc. (The varargs feature of java 1.5 half-solves this problem, by automatically wrapping args in an array, but it does so without testing the level.)

Usage: replace:

static final Logger tracer = CalciteTracer.getMyTracer();

by:

static final CalciteLogger tracer = new CalciteLogger(CalciteTrace.getMyTracer());
  • Constructor Details

    • CalciteLogger

      public CalciteLogger(org.slf4j.Logger logger)
  • Method Details

    • warn

      public void warn(String format, @Nullable Object arg1, @Nullable Object arg2)
      Logs a WARN message with two Object parameters.
    • warn

      public void warn(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3)
      Conditionally logs a WARN message with three Object parameters.
    • warn

      public void warn(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3, @Nullable Object arg4)
      Conditionally logs a WARN message with four Object parameters.
    • warn

      public void warn(String format, Object... args)
    • info

      public void info(String format, @Nullable Object arg1, @Nullable Object arg2)
      Logs an INFO message with two Object parameters.
    • info

      public void info(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3)
      Conditionally logs an INFO message with three Object parameters.
    • info

      public void info(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3, @Nullable Object arg4)
      Conditionally logs an INFO message with four Object parameters.
    • info

      public void info(String format, Object... args)
    • debug

      public void debug(String format, @Nullable Object arg1, @Nullable Object arg2)
      Logs a DEBUG message with two Object parameters.
    • debug

      public void debug(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3)
      Conditionally logs a DEBUG message with three Object parameters.
    • debug

      public void debug(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3, @Nullable Object arg4)
      Conditionally logs a DEBUG message with four Object parameters.
    • debug

      public void debug(String format, Object... args)
    • trace

      public void trace(String format, @Nullable Object arg1, @Nullable Object arg2)
      Logs a TRACE message with two Object parameters.
    • trace

      public void trace(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3)
      Conditionally logs a TRACE message with three Object parameters.
    • trace

      public void trace(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3, @Nullable Object arg4)
      Conditionally logs a TRACE message with four Object parameters.
    • trace

      public void trace(String format, @Nullable Object... args)
    • getLogger

      public org.slf4j.Logger getLogger()
    • warn

      public void warn(String msg)
    • info

      public void info(String msg)