Class CLogger

java.lang.Object
java.util.logging.Logger
org.compiere.util.CLogger

public class CLogger extends Logger
iDempiere Logger
Version:
$Id: CLogger.java,v 1.3 2006/08/09 16:38:47 jjanke Exp $
Author:
Jorg Janke
  • Method Details

    • getCLogger

      public static CLogger getCLogger(String className)
      Get Logger
      Parameters:
      className - class name
      Returns:
      Logger
    • getCLogger

      public static CLogger getCLogger(String className, boolean usePackageLevel)
      Get Logger
      Parameters:
      className - class name
      usePackageLevel -
      Returns:
      Logger
    • getCLogger

      public static CLogger getCLogger(Class<?> clazz)
      Get Logger
      Parameters:
      clazz - class name
      Returns:
      Logger
    • get

      public static CLogger get()
      Get default iDempiere Logger.
      Returns:
      logger
    • saveError

      public boolean saveError(String AD_Message, String message)
      Set and issue Error and save as ValueNamePair (LAST_ERROR in environment context)
      Parameters:
      AD_Message - message key
      message - clear text message
      Returns:
      true (to avoid removal of method)
    • saveError

      public boolean saveError(String AD_Message, Exception ex)
      Set and issue Error and save into context as ValueNamePair (LAST_EXCEPTION and LAST_ERROR in environment context)
      Parameters:
      AD_Message - message key
      ex - exception
      Returns:
      true (to avoid removal of method)
    • saveError

      public boolean saveError(String AD_Message, Exception ex, boolean issueError)
      Set and issue (if specified) Error and save as ValueNamePair (LAST_EXCEPTION and LAST_ERROR in environment context)
      Parameters:
      AD_Message - message key
      ex - exception
      issueError - if true will issue an error
      Returns:
      true (to avoid removal of method)
    • saveError

      public boolean saveError(String AD_Message, String message, Exception ex)
      Save exception as environment context's last exception (LAST_EXCEPTION).
      Create ValueNamePair(AD_Message, message) and save into environment context as last error (LAST_ERROR).
      Issue/publish AD_Message and message as severe log message
      Parameters:
      AD_Message - message key
      message -
      ex - exception
      Returns:
      true (to avoid removal of method)
    • saveError

      public boolean saveError(String AD_Message, String message, Exception ex, boolean issueError)
      Save exception as environment context's last exception (LAST_EXCEPTION).
      Create ValueNamePair(AD_Message, message) and save into environment context as last error (LAST_ERROR).
      Issue/publish AD_Message and message as severe log message if issueError is true.
      Parameters:
      AD_Message - message key
      message -
      ex - exception
      issueError - if true will issue an error
      Returns:
      true (to avoid removal of method)
    • saveError

      public boolean saveError(String AD_Message, String message, boolean issueError)
      Create ValueNamePair(AD_Message, message) and save into environment context as last error (LAST_ERROR).
      Issue/publish AD_Message and message as severe log message if issueError is true.
      Parameters:
      AD_Message - message key
      message - clear text message
      issueError - print error message (default true)
      Returns:
      true
    • retrieveError

      public static ValueNamePair retrieveError()
      Get and remove last error from environment context
      Returns:
      AD_Message as Value and Message as String
    • peekError

      public static ValueNamePair peekError()
      Get last error from environment context
      Returns:
      AD_Message as Value and Message as String
    • retrieveErrorString

      public static String retrieveErrorString(String defaultMsg)
      Get and remove last error message from environment context.
      Parameters:
      defaultMsg - default message (used when there are no errors on stack)
      Returns:
      error message, or defaultMsg if there is no error message saved
      See Also:
    • retrieveException

      public static Exception retrieveException()
      Get and remove last exception from environment context.
      Returns:
      last exception
    • peekException

      public static Exception peekException()
      Get last exception from environment context.
      Returns:
      last exception
    • saveWarning

      public boolean saveWarning(String AD_Message, String message)
      Create ValueNamePair(AD_Message, message) and save into environment context as last warning.
      Issue/publish AD_Message and message as warning log message
      Parameters:
      AD_Message - message key
      message - clear text message
      Returns:
      true
    • retrieveWarningString

      public static String retrieveWarningString(String defaultMsg)
      Get and remove last Warning message from environment context.
      Parameters:
      defaultMsg - default message (used when there are no warnings on stack)
      Returns:
      error message, or defaultMsg if there is not error message saved
      See Also:
    • retrieveWarning

      public static ValueNamePair retrieveWarning()
      Get and remove last Warning from environment context
      Returns:
      AD_Message as Value and Message as String
    • saveInfo

      public boolean saveInfo(String AD_Message, String message)
      Create ValueNamePair(AD_Message, message) and save into environment context as last info.
      Issue/publish AD_Message and message as info log message
      Parameters:
      AD_Message - message key
      message - clear text message
      Returns:
      true
    • retrieveInfo

      public static ValueNamePair retrieveInfo()
      Get and remove last Info from environment context
      Returns:
      AD_Message as Value and Message as String
    • resetLast

      public static void resetLast()
      Remove last Saved Messages/Errors/Info from environment context
    • getRootCause

      public static Throwable getRootCause(Throwable t)
      Get root cause
      Parameters:
      t -
      Returns:
      Throwable
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class Object
      Returns:
      info