Class Logger

java.lang.Object
com.oracle.coherence.common.base.Logger

public abstract class Logger extends Object
Logging API.
Since:
20.06
Author:
Aleks Seovic 2020.05.18
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Severity 0 will always be logged.
    static final int
    Severity 4 indicates configuration related log message.
    static final int
    Severity 1 indicates an error.
    static final int
    Severity 5 indicates an essential debug message.
    static final int
    Severity 6 indicates a non-essential debug message.
    static final int
    Severity 7 indicates a very low-level, non-essential debug message or a tracing message.
    static final int
    Severity 3 indicates information that should likely be logged.
    static final int
    Severity 2 indicates a warning.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    config(String sMessage)
    Log the specified message with CONFIG severity.
    static void
    config(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with CONFIG severity.
    static void
    Log the specified exception information (message and stack trace) with CONFIG severity.
    static void
    config(Supplier<String> supplierMessage)
    Log the specified message with CONFIG severity.
    static void
    config(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with CONFIG severity.
    static void
    entering(Class<?> clz, String sMethod, Object... params)
    Entry logging.
    static void
    err(String sMessage)
    Log the specified message with ERROR severity.
    static void
    err(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with ERROR severity.
    static void
    Log the specified exception information (message and stack trace) with ERROR severity.
    static void
    err(Supplier<String> supplierMessage)
    Log the specified message with ERROR severity.
    static void
    err(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with ERROR severity.
    static void
    exiting(Class<?> clz, String sMethod)
    Exit logging.
    static void
    exiting(Class<?> clz, String sMethod, Object result, Object... additionalInfo)
    Exit logging.
    static void
    fine(String sMessage)
    Log the specified message with FINE severity.
    static void
    fine(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with FINE severity.
    static void
    Log the specified exception information (message and stack trace) with FINE severity.
    static void
    fine(Supplier<String> supplierMessage)
    Log the specified message with FINE severity.
    static void
    fine(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with FINE severity.
    static void
    finer(String sMessage)
    Log the specified message with FINER severity.
    static void
    finer(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with FINER severity.
    static void
    Log the specified exception information (message and stack trace) with FINER severity.
    static void
    finer(Supplier<String> supplierMessage)
    Log the specified message with FINER severity.
    static void
    finer(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with FINER severity.
    static void
    finest(String sMessage)
    Log the specified message with FINEST severity.
    static void
    finest(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with FINEST severity.
    static void
    Log the specified exception information (message and stack trace) with FINEST severity.
    static void
    finest(Supplier<String> supplierMessage)
    Log the specified message with FINEST severity.
    static void
    finest(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with FINEST severity.
    static void
    info(String sMessage)
    Log the specified message with INFO severity.
    static void
    info(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with INFO severity.
    static void
    Log the specified exception information (message and stack trace) with INFO severity.
    static void
    info(Supplier<String> supplierMessage)
    Log the specified message with INFO severity.
    static void
    info(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with INFO severity.
    static boolean
    isEnabled(int nSeverity)
    Return true if the specified severity level should be logged.
    static void
    log(String sMessage, int nSeverity)
    Log the specified message at the specified severity level.
    static void
    log(String sMessage, Throwable e, int nSeverity)
    Log the specified message and the exception stack trace at the specified severity level.
    static void
    log(Throwable e, int nSeverity)
    Log the specified exception information (message and stack trace) at the specified severity level.
    static void
    log(Supplier<String> supplierMessage, int nSeverity)
    Log the specified message at the specified severity level.
    static void
    log(Supplier<String> supplierMessage, Throwable e, int nSeverity)
    Log the specified message and the exception stack trace at the specified severity level.
    static void
    out(String sMessage)
    Log the specified message with ALWAYS severity.
    static void
    out(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with ALWAYS severity.
    static void
    Log the specified exception information (message and stack trace) with ALWAYS severity.
    static void
    out(Supplier<String> supplierMessage)
    Log the specified message with ALWAYS severity.
    static void
    out(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with ALWAYS severity.
    static void
    setLoggingLevel(int nSeverity)
    Set the logging level.
    static void
    throwing(Class<?> clz, String sMethod, Throwable throwable, Object... additionalInfo)
    Throwable logging.
    static void
    warn(String sMessage)
    Log the specified message with WARNING severity.
    static void
    warn(String sMessage, Throwable e)
    Log the specified message and the exception stack trace with WARNING severity.
    static void
    Log the specified exception information (message and stack trace) with WARNING severity.
    static void
    warn(Supplier<String> supplierMessage)
    Log the specified message with WARNING severity.
    static void
    warn(Supplier<String> supplierMessage, Throwable e)
    Log the specified message and the exception stack trace with WARNING severity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALWAYS

      public static final int ALWAYS
      Severity 0 will always be logged.
      See Also:
    • ERROR

      public static final int ERROR
      Severity 1 indicates an error.
      See Also:
    • WARNING

      public static final int WARNING
      Severity 2 indicates a warning.
      See Also:
    • INFO

      public static final int INFO
      Severity 3 indicates information that should likely be logged.
      See Also:
    • CONFIG

      public static final int CONFIG
      Severity 4 indicates configuration related log message.
      See Also:
    • FINE

      public static final int FINE
      Severity 5 indicates an essential debug message.
      See Also:
    • FINER

      public static final int FINER
      Severity 6 indicates a non-essential debug message.
      See Also:
    • FINEST

      public static final int FINEST
      Severity 7 indicates a very low-level, non-essential debug message or a tracing message.
      See Also:
  • Constructor Details

    • Logger

      public Logger()
  • Method Details

    • isEnabled

      public static boolean isEnabled(int nSeverity)
      Return true if the specified severity level should be logged.
      Parameters:
      nSeverity - the severity level
      Returns:
      true if the specified severity level should be logged; false otherwise
    • log

      public static void log(String sMessage, int nSeverity)
      Log the specified message at the specified severity level.
      Parameters:
      sMessage - the message to log
      nSeverity - the severity level
    • log

      public static void log(Supplier<String> supplierMessage, int nSeverity)
      Log the specified message at the specified severity level. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      nSeverity - the severity level
    • log

      public static void log(String sMessage, Throwable e, int nSeverity)
      Log the specified message and the exception stack trace at the specified severity level.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
      nSeverity - the severity level
    • log

      public static void log(Supplier<String> supplierMessage, Throwable e, int nSeverity)
      Log the specified message and the exception stack trace at the specified severity level. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
      nSeverity - the severity level
    • log

      public static void log(Throwable e, int nSeverity)
      Log the specified exception information (message and stack trace) at the specified severity level.
      Parameters:
      e - the exception to log
      nSeverity - the severity level
    • out

      public static void out(String sMessage)
      Log the specified message with ALWAYS severity.
      Parameters:
      sMessage - the message to log
    • out

      public static void out(Supplier<String> supplierMessage)
      Log the specified message with ALWAYS severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • out

      public static void out(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with ALWAYS severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • out

      public static void out(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with ALWAYS severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • out

      public static void out(Throwable e)
      Log the specified exception information (message and stack trace) with ALWAYS severity.
      Parameters:
      e - the exception to log
    • err

      public static void err(String sMessage)
      Log the specified message with ERROR severity.
      Parameters:
      sMessage - the message to log
    • err

      public static void err(Supplier<String> supplierMessage)
      Log the specified message with ERROR severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • err

      public static void err(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with ERROR severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • err

      public static void err(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with ERROR severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • err

      public static void err(Throwable e)
      Log the specified exception information (message and stack trace) with ERROR severity.
      Parameters:
      e - the exception to log
    • warn

      public static void warn(String sMessage)
      Log the specified message with WARNING severity.
      Parameters:
      sMessage - the message to log
    • warn

      public static void warn(Supplier<String> supplierMessage)
      Log the specified message with WARNING severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • warn

      public static void warn(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with WARNING severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • warn

      public static void warn(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with WARNING severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • warn

      public static void warn(Throwable e)
      Log the specified exception information (message and stack trace) with WARNING severity.
      Parameters:
      e - the exception to log
    • info

      public static void info(String sMessage)
      Log the specified message with INFO severity.
      Parameters:
      sMessage - the message to log
    • info

      public static void info(Supplier<String> supplierMessage)
      Log the specified message with INFO severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • info

      public static void info(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with INFO severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • info

      public static void info(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with INFO severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • info

      public static void info(Throwable e)
      Log the specified exception information (message and stack trace) with INFO severity.
      Parameters:
      e - the exception to log
    • config

      public static void config(String sMessage)
      Log the specified message with CONFIG severity.
      Parameters:
      sMessage - the message to log
    • config

      public static void config(Supplier<String> supplierMessage)
      Log the specified message with CONFIG severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • config

      public static void config(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with CONFIG severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • config

      public static void config(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with CONFIG severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • config

      public static void config(Throwable e)
      Log the specified exception information (message and stack trace) with CONFIG severity.
      Parameters:
      e - the exception to log
    • fine

      public static void fine(String sMessage)
      Log the specified message with FINE severity.
      Parameters:
      sMessage - the message to log
    • fine

      public static void fine(Supplier<String> supplierMessage)
      Log the specified message with FINE severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • fine

      public static void fine(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with FINE severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • fine

      public static void fine(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with FINE severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • fine

      public static void fine(Throwable e)
      Log the specified exception information (message and stack trace) with FINE severity.
      Parameters:
      e - the exception to log
    • finer

      public static void finer(String sMessage)
      Log the specified message with FINER severity.
      Parameters:
      sMessage - the message to log
    • finer

      public static void finer(Supplier<String> supplierMessage)
      Log the specified message with FINER severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • finer

      public static void finer(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with FINER severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • finer

      public static void finer(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with FINER severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • finer

      public static void finer(Throwable e)
      Log the specified exception information (message and stack trace) with FINER severity.
      Parameters:
      e - the exception to log
    • finest

      public static void finest(String sMessage)
      Log the specified message with FINEST severity.
      Parameters:
      sMessage - the message to log
    • finest

      public static void finest(Supplier<String> supplierMessage)
      Log the specified message with FINEST severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
    • finest

      public static void finest(String sMessage, Throwable e)
      Log the specified message and the exception stack trace with FINEST severity.
      Parameters:
      sMessage - the message to log
      e - the exception to log the stack trace for
    • finest

      public static void finest(Supplier<String> supplierMessage, Throwable e)
      Log the specified message and the exception stack trace with FINEST severity. The message is provided by the Supplier, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.
      Parameters:
      supplierMessage - the supplier of the message to log; only evaluated if the specified severity level should be logged
      e - the exception to log the stack trace for
    • finest

      public static void finest(Throwable e)
      Log the specified exception information (message and stack trace) with FINEST severity.
      Parameters:
      e - the exception to log
    • entering

      public static void entering(Class<?> clz, String sMethod, Object... params)
      Entry logging.
      Parameters:
      clz - the source Class
      sMethod - the source method
      params - zero or more parameters to log
      Throws:
      NullPointerException - if either clz or sMethod are null
      Since:
      22.06
    • exiting

      public static void exiting(Class<?> clz, String sMethod)
      Exit logging.
      Parameters:
      clz - the source Class
      sMethod - the source method
      Throws:
      NullPointerException - if either clz or sMethod are null
      Since:
      22.06
    • exiting

      public static void exiting(Class<?> clz, String sMethod, Object result, Object... additionalInfo)
      Exit logging.
      Parameters:
      clz - the source Class
      sMethod - the source method
      result - the result returned by the exiting method
      additionalInfo - zero or more additional state details at the time of exit
      Throws:
      NullPointerException - if either clz or sMethod are null
      Since:
      22.06
    • throwing

      public static void throwing(Class<?> clz, String sMethod, Throwable throwable, Object... additionalInfo)
      Throwable logging.
      Parameters:
      clz - the source Class
      sMethod - the source method
      throwable - the Exception being thrown
      additionalInfo - zero or more additional state details at the time of exit
      Throws:
      NullPointerException - if any arguments are null
      Since:
      22.06
    • setLoggingLevel

      public static void setLoggingLevel(int nSeverity)
      Set the logging level.
      Parameters:
      nSeverity - the severity level
      Since:
      22.09