Class LogFactory

java.lang.Object
org.flywaydb.core.api.logging.LogFactory

public class LogFactory extends Object
Factory for loggers. Custom MigrationResolver, MigrationExecutor, Callback and JavaMigration implementations should use this to obtain a logger that will work with any logging framework across all environments (API, Maven, Gradle, CLI, etc.).
  • Method Details

    • setConfiguration

      public static void setConfiguration(Configuration configuration)
    • getLog

      public static Log getLog(Class<?> clazz)
      Retrieves the matching logger for this class.
      Parameters:
      clazz - The class to get the logger for.
      Returns:
      The logger.
    • setLogCreator

      public static void setLogCreator(LogCreator logCreator)
      Sets the LogCreator that will be used. This will effectively override Flyway's default LogCreator auto-detection logic and force Flyway to always use this LogCreator regardless of which log libraries are present on the classpath. This is primarily meant for integrating Flyway into environments with their own logging system (like Ant, Gradle, Maven, ...). This ensures Flyway is a good citizen in those environments and sends its logs through the expected pipeline.
      Parameters:
      logCreator - The factory for implementation-specific loggers.
    • setFallbackLogCreator

      public static void setFallbackLogCreator(LogCreator fallbackLogCreator)
      Sets the fallback LogCreator. This LogCreator will be used as a fallback solution when the default LogCreator auto-detection logic fails to detect a suitable LogCreator based on the log libraries present on the classpath.
      Parameters:
      fallbackLogCreator - The factory for implementation-specific loggers to be used as a fallback when no other suitable loggers were found.