Class Logging

java.lang.Object
de.espirit.common.base.Logging

@GwtCompatible @NonExtendable public class Logging extends Object
The Logging is used to log messages for a given class. Each message is related to a specific log level and might be combined with a stack trace.
Since:
4.2.38
  • Constructor Details

    • Logging

      public Logging()
  • Method Details

    • isTraceEnabled

      public static boolean isTraceEnabled(@NotNull @NotNull Class<?> clazz)
      Check whether the TRACE level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      clazz - The class for which is checked if the TRACE level is enabled.
      Returns:
      boolean: true if TRACE level is enabled, false if it is not enabled
      Since:
      4.2.38
    • isTraceEnabled

      public static boolean isTraceEnabled(@NotNull @NotNull String name)
      Check whether the TRACE level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      name - The name of the logger for which is checked if the TRACE level is enabled.
      Returns:
      boolean: true if TRACE level is enabled, false if it is not enabled
      Since:
      5.2.230406
    • logTrace

      public static void logTrace(@NotNull @NotNull String message, @NotNull @NotNull Class<?> logger)
      Checks first whether the TRACE level is enabled for the given class. If so the message is logged.
      Parameters:
      message - The message that should be logged.
      logger - The class for which the message should be logged.
      Since:
      4.2.38
    • logTrace

      public static void logTrace(@NotNull @NotNull String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Checks first whether the TRACE level is enabled for the given class. If so the message and the stack trace which causes the message are logged.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace that causes the message.
      logger - The class for which the message and the stack trace should be logged.
      Since:
      4.2.38
    • isDebugEnabled

      public static boolean isDebugEnabled(@NotNull @NotNull Class<?> clazz)
      Check whether the DEBUG level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      clazz - The class for which is checked if the DEBUG level is enabled.
      Returns:
      boolean: true if DEBUG level is enabled, false if it is not enabled
      Since:
      4.2.38
    • isDebugEnabled

      public static boolean isDebugEnabled(@NotNull @NotNull String name)
      Check whether the DEBUG level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      name - The name of the logger for which is checked if the DEBUG level is enabled.
      Returns:
      boolean: true if DEBUG level is enabled, false if it is not enabled
      Since:
      5.2.230406
    • logDebug

      public static void logDebug(String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Checks first whether the DEBUG level is enabled for the given class. If so the message and the stack trace which causes the debug message are logged.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace that causes the message.
      logger - The class for which the message and the stack trace should be logged.
      Since:
      4.2.38
    • logDebug

      public static void logDebug(String message, @NotNull @NotNull Class<?> logger)
      Checks first whether the DEBUG level is enabled for the given class. If so the given message is logged.
      Parameters:
      message - The message that should be logged.
      logger - The class for which the message should be logged.
      Since:
      4.2.38
    • isInfoEnabled

      public static boolean isInfoEnabled(@NotNull @NotNull Class<?> logger)
      Check whether the INFO level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      logger - The class for which is checked if the INFO level is enabled.
      Returns:
      boolean: true if INFO level is enabled, false if it is not enabled
      Since:
      4.2.38
    • isInfoEnabled

      public static boolean isInfoEnabled(@NotNull @NotNull String name)
      Check whether the INFO level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      name - The name of the logger for which is checked if the INFO level is enabled.
      Returns:
      boolean: true if INFO level is enabled, false if it is not enabled
      Since:
      5.2.230406
    • logInfo

      public static void logInfo(String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Checks first whether the INFO level is enabled for the given class. If so the message and the stack trace which causes the information are logged.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace that causes the message.
      logger - The class for which the message and the stack trace should be logged.
      Since:
      4.2.38
    • logInfo

      public static void logInfo(String message, @NotNull @NotNull Class<?> logger)
      Checks first whether the INFO level is enabled for the given class. If so the given message is logged.
      Parameters:
      message - The message that should be logged.
      logger - The class for which the message should be logged.
      Since:
      4.2.38
    • isWarnEnabled

      public static boolean isWarnEnabled(@NotNull @NotNull Class<?> logger)
      Check whether the WARN level is enabled for the given class. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      logger - The class for which is checked if the WARN level is enabled.
      Returns:
      boolean: true if WARN level is enabled, false if it is not enabled
      Since:
      4.2.38
    • isWarnEnabled

      public static boolean isWarnEnabled(@NotNull @NotNull String name)
      Check whether the WARN level is enabled for the given logger name. This method can be used to prevent unnecessary expensive message creation if the level is not enabled.
      Parameters:
      name - The name of the logger for which is checked if the WARN level is enabled.
      Returns:
      boolean: true if WARN level is enabled, false if it is not enabled
      Since:
      5.2.230406
    • logWarning

      public static void logWarning(String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Checks first whether the WARN level is enabled for the given class. If so the message and the stack trace which causes the warning are logged.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace that causes the message.
      logger - The class for which the message and the stack trace should be logged.
      Since:
      4.2.38
    • logWarning

      public static void logWarning(String message, @NotNull @NotNull Class<?> logger)
      Checks first whether the WARN level is enabled for the given class. If so the message is logged.
      Parameters:
      message - The message that should be logged.
      logger - The class for that the message should be logged.
      Since:
      4.2.38
    • logError

      public static void logError(String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Logs the error message and the stack trace which causes the message for the given class.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace which causes the message.
      logger - The class for which the message and the stack trace should be logged.
      Since:
      4.2.38
    • logError

      public static void logError(String message, @NotNull @NotNull Class<?> logger)
      Logs the given error message for the given class.
      Parameters:
      message - The message that should be logged.
      logger - The class for that the message should be logged.
      Since:
      4.2.38
    • logFatal

      public static void logFatal(@NotNull @NotNull String message, @NotNull @NotNull Class<?> logger)
      Logs the given fatal message for the given class.
      Parameters:
      message - The message that should be logged.
      logger - The class for that the message should be logged.
      Since:
      4.2.38
    • logFatal

      public static void logFatal(@NotNull @NotNull String message, Throwable cause, @NotNull @NotNull Class<?> logger)
      Logs the fatal message and the stack trace which causes the message for the given class.
      Parameters:
      message - The message that should be logged.
      cause - The stack trace that causes the message.
      logger - The class for that the message and the stack trace should be logged.
      Since:
      4.2.38
    • init

      public static void init(@Nullable @Nullable Logger logger)
      Initialization of the Logger. If the given logger is null, a default value is used.
      Parameters:
      logger - The given logger; could be null.
      Since:
      4.2.38
    • initMDC

      public static void initMDC(@Nullable @Nullable MappedDiagnosticContext mdc)
      Initialization of the MappedDiagnosticContext. If the given MappedDiagnosticContext is null, a default value is used.
      Parameters:
      mdc - The given MappedDiagnosticContext; could be null.
      Since:
      4.2.38
    • getLogger

      @NotNull public static @NotNull Logger getLogger()
      Get the Logger instance.
      Returns:
      Logger
      Since:
      4.2.38
      See Also:
    • getMappedDiagnosticContext

      @NotNull public static @NotNull MappedDiagnosticContext getMappedDiagnosticContext()
      Get the MappedDiagnosticContext instance.
      Returns:
      MappedDiagnosticContext
      Since:
      4.2.38
      See Also: