Class Logger

java.lang.Object
com.intellij.openapi.diagnostic.Logger
Direct Known Subclasses:
DefaultLogger

public abstract class Logger extends Object
A standard interface to write to %system%/log/idea.log (or %system%/testlog/idea.log in tests).

In addition to writing to log file, "error" methods result in showing "IDE fatal errors" dialog in the IDE, in EAP versions or if "idea.fatal.error.notification" system property is "true" (). See com.intellij.diagnostic.DefaultIdeaErrorLogger#canHandle for more details.

Note that in production, a call to "error" doesn't throw exceptions so the execution continues. In tests, however, an AssertionError is thrown.

In most non-performance tests, debug level is enabled by default, so that when a test fails the full contents of its log are printed to stdout.

  • Constructor Details

    • Logger

      public Logger()
  • Method Details

    • setFactory

      public static void setFactory(@NotNull @NotNull Class<? extends Logger.Factory> factory)
    • getFactory

      public static Logger.Factory getFactory()
    • isInitialized

      public static boolean isInitialized()
    • getInstance

      @NotNull public static @NotNull Logger getInstance(@NotNull @NotNull String category)
    • getInstance

      @NotNull public static @NotNull Logger getInstance(@NotNull @NotNull Class cl)
    • isDebugEnabled

      public abstract boolean isDebugEnabled()
    • debug

      public abstract void debug(String message)
    • debug

      public abstract void debug(@Nullable @Nullable Throwable t)
    • debug

      public abstract void debug(String message, @Nullable @Nullable Throwable t)
    • debug

      public void debug(@NotNull @NotNull String message, @NotNull @NotNull Object... details)
    • isTraceEnabled

      public boolean isTraceEnabled()
    • trace

      public void trace(String message)
      Log a message with 'trace' level which finer-grained than 'debug' level. Use this method instead of debug(String) for internal events of a subsystem to avoid overwhelming the log if 'debug' level is enabled.
    • trace

      public void trace(@Nullable @Nullable Throwable t)
    • info

      public void info(@NotNull @NotNull Throwable t)
    • info

      public abstract void info(String message)
    • info

      public abstract void info(String message, @Nullable @Nullable Throwable t)
    • warn

      public void warn(String message)
    • warn

      public void warn(@NotNull @NotNull Throwable t)
    • warn

      public abstract void warn(String message, @Nullable @Nullable Throwable t)
    • error

      public void error(String message)
    • error

      public void error(Object message)
    • error

      public void error(String message, @NotNull @NotNull String... details)
    • error

      public abstract void error(String message, @Nullable @Nullable Throwable t, @NotNull @NotNull String... details)
    • assertTrue

      @Contract("false,_->fail") public boolean assertTrue(boolean value, @Nullable @Nullable Object message)
    • assertTrue

      @Contract("false->fail") public boolean assertTrue(boolean value)