Interface Log

All Known Implementing Classes:
DefaultLog

@Experimental @Provider public interface Log
This interface supplies the API for providing feedback to the user from the Mojo, using standard Maven channels. There should be no big surprises here, although you may notice that the methods accept java.lang.CharSequence rather than java.lang.String. This is provided mainly as a convenience, to enable developers to pass things like java.lang.StringBuffer directly into the logger, rather than formatting first by calling toString().
Since:
4.0.0
  • Method Details

    • isTraceEnabled

      default boolean isTraceEnabled()
      Returns true if the trace error level is enabled.

      The default implementation returns false for backward compatibility with existing Log implementations.

      Returns:
      true if the trace error level is enabled
    • trace

      default void trace(CharSequence content)
      Sends a message to the user in the trace error level.

      Trace is the most verbose level, intended for Maven core internals such as resolver negotiation, model interpolation, and lifecycle ordering details. Use debug(CharSequence) instead for messages that help users investigate their build (e.g. why a module was recompiled).

      The default implementation is a no-op for backward compatibility.

      Parameters:
      content - the message to log
    • trace

      default void trace(CharSequence content, Throwable error)
      Sends a message (and accompanying exception) to the user at the trace error level. The error's stacktrace will be output when this error level is enabled.

      The default implementation is a no-op for backward compatibility.

      Parameters:
      content - the message to log
      error - the error that caused this log
    • trace

      default void trace(Throwable error)
      Sends an exception to the user in the trace error level. The stack trace for this exception will be output when this error level is enabled.

      The default implementation is a no-op for backward compatibility.

      Parameters:
      error - the error that caused this log
    • trace

      default void trace(Supplier<String> content)
      Sends a lazily-computed message in the trace error level. The supplier is only evaluated if trace is enabled.

      The default implementation is a no-op for backward compatibility.

      Parameters:
      content - the message supplier
    • trace

      default void trace(Supplier<String> content, Throwable error)
      Sends a lazily-computed message (and accompanying exception) in the trace error level. The supplier is only evaluated if trace is enabled.

      The default implementation is a no-op for backward compatibility.

      Parameters:
      content - the message supplier
      error - the error that caused this log
    • isDebugEnabled

      boolean isDebugEnabled()
      Returns true if the debug error level is enabled.
      Returns:
      true if the debug error level is enabled
    • debug

      void debug(CharSequence content)
      Sends a message to the user in the debug error level.

      Debug is intended for messages that help users investigate their build — for example, why a module was recompiled or what classpath was resolved. For Maven core internals, use trace(CharSequence) instead.

      Parameters:
      content - the message to log
    • debug

      void debug(CharSequence content, Throwable error)
      Sends a message (and accompanying exception) to the user in the debug error level. The error's stacktrace will be output when this error level is enabled.
      Parameters:
      content - the message to log
      error - the error that caused this log
    • debug

      void debug(Throwable error)
      Sends an exception to the user in the debug error level. The stack trace for this exception will be output when this error level is enabled.
      Parameters:
      error - the error that caused this log
    • debug

      void debug(Supplier<String> content)
    • debug

      void debug(Supplier<String> content, Throwable error)
    • isInfoEnabled

      boolean isInfoEnabled()
      Returns true if the info error level is enabled.
      Returns:
      true if the info error level is enabled
    • info

      void info(CharSequence content)
      Sends a message to the user in the info error level.
      Parameters:
      content - the message to log
    • info

      void info(CharSequence content, Throwable error)
      Sends a message (and accompanying exception) to the user in the info error level. The error's stacktrace will be output when this error level is enabled.
      Parameters:
      content - the message to log
      error - the error that caused this log
    • info

      void info(Throwable error)
      Sends an exception to the user in the info error level. The stack trace for this exception will be output when this error level is enabled.
      Parameters:
      error - the error that caused this log
    • info

      void info(Supplier<String> content)
    • info

      void info(Supplier<String> content, Throwable error)
    • isWarnEnabled

      boolean isWarnEnabled()
      Returns true if the warn error level is enabled.
      Returns:
      true if the warn error level is enabled
    • warn

      void warn(CharSequence content)
      Sends a message to the user in the warn error level.
      Parameters:
      content - the message to log
    • warn

      void warn(CharSequence content, Throwable error)
      Sends a message (and accompanying exception) to the user in the warn error level. The error's stacktrace will be output when this error level is enabled.
      Parameters:
      content - the message to log
      error - the error that caused this log
    • warn

      void warn(Throwable error)
      Sends an exception to the user in the warn error level. The stack trace for this exception will be output when this error level is enabled.
      Parameters:
      error - the error that caused this log
    • warn

      void warn(Supplier<String> content)
    • warn

      void warn(Supplier<String> content, Throwable error)
    • isErrorEnabled

      boolean isErrorEnabled()
      Returns true if the error error level is enabled.
      Returns:
      true if the error error level is enabled
    • error

      void error(CharSequence content)
      Sends a message to the user in the error error level.
      Parameters:
      content - the message to log
    • error

      void error(CharSequence content, Throwable error)
      Sends a message (and accompanying exception) to the user in the error error level. The error's stacktrace will be output when this error level is enabled.
      Parameters:
      content - the message to log
      error - the error that caused this log
    • error

      void error(Throwable error)
      Sends an exception to the user in the error error level. The stack trace for this exception will be output when this error level is enabled.
      Parameters:
      error - the error that caused this log
    • error

      void error(Supplier<String> content)
    • error

      void error(Supplier<String> content, Throwable error)
    • child

      default Log child(String name)
      Returns a child logger whose name is derived from this logger's name by appending a dot and the given suffix.

      For example, if a plugin's logger is named "org.apache.maven.plugins.compiler.CompilerMojo", then child("diagnostics") returns a logger named "org.apache.maven.plugins.compiler.CompilerMojo.diagnostics". This lets sub-components log under an independently filterable name without requiring a separate injection point.

      The default implementation returns this, so existing Log implementations continue to work without changes. Implementations that wrap a hierarchical logging backend (such as SLF4J) should override this to create a real child logger.

      Parameters:
      name - the suffix to append (must not be null or blank)
      Returns:
      a child logger — never null