Class Logs

java.lang.Object
de.hybris.platform.util.logging.Logs

public final class Logs extends Object
Helper methods for improving usability of Log4j logger
  • Constructor Details

    • Logs

      public Logs()
  • Method Details

    • debug

      public static void debug(org.apache.log4j.Logger log, Supplier logLineSupplier)
      Writes a log line with the DEBUG priority. Line might be provided by lambda expression, which is evaluated only when DEBUG is enabled on a given logger. It delegates to Category.debug(Object).

      This method allows you to write:

       
       		Logs.debug(LOG, () -> "Something " + calculateSomething() + " is wrong.");
       
       

      calculateSomething() will be called only when DEBUG is enabled.

      Parameters:
      log - logger to use
      logLineSupplier - log line supplier
    • debug

      public static void debug(org.apache.log4j.Logger log, Supplier logLineSupplier, Throwable throwable)
      Writes a log line with the DEBUG priority. Line might be provided by lambda expression, which is evaluated only when DEBUG is enabled on a given logger. It delegates to Category.debug(Object).

      This method allows you to write:

       
       		Logs.debug(LOG, () -> "Something " + calculateSomething() + " is wrong.", exception);
       
       

      calculateSomething() will be called only when DEBUG is enabled.

      Parameters:
      log - logger to use
      logLineSupplier - log line supplier
      throwable - throwable to log