Class LogSystems

java.lang.Object
migratedb.v1.core.api.logging.LogSystems

public final class LogSystems extends Object
Pre-defined log system names and auto-detection.
  • Field Details

  • Constructor Details

    • LogSystems

      public LogSystems()
  • Method Details

    • fromStrings

      public static LogSystem fromStrings(Set<String> logSystemNames, ClassLoader classLoader, @Nullable LogSystem fallback)
      Creates a log system that forwards logging calls to all log system names in logSystemNames. Each log system name must either be one of the string constants in this class or the fully qualified name of a class that implements LogSystem and has a public no-arg constructor.
      Parameters:
      logSystemNames - The log system names to parse
      classLoader - Used to instantiate classes by name
      fallback - Used for AUTO_DETECT and CONSOLE (the latter being a direct alias for it)
      Returns:
      Log system that delegates to all log systems identified by logSystemNames.
    • custom

      public static LogSystem custom(String className, ClassLoader classLoader)
      Instantiates a class that implements LogSystem.
      Parameters:
      className - Fully qualified name of class to instantiate. Class must have a public no-arg constructor.
      classLoader - Class loader to use.
      Returns:
      The custom log system.
    • autoDetect

      public static LogSystem autoDetect(ClassLoader classLoader, @Nullable LogSystem fallback)
      Auto-detects the "best" available log system and returns an instance of it. The order of precedence is:
      1. If one of the supported logging libraries is found via classLoader, use it.
      2. If fallback is non-null, use that.
      3. Use java.util.logging.
      Parameters:
      classLoader - Used to check for the presence of supported logging libraries.
      fallback - Log system to use over java.util.logging
      Returns:
      Auto-detected log system.