Package org.flywaydb.core.api.logging
Class LogFactory
java.lang.Object
org.flywaydb.core.api.logging.LogFactory
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 Summary
Modifier and TypeMethodDescriptionstatic Log
Retrieves the matching logger for this class.static void
setConfiguration
(Configuration configuration) static void
setFallbackLogCreator
(LogCreator fallbackLogCreator) Sets the fallback LogCreator.static void
setLogCreator
(LogCreator logCreator) Sets the LogCreator that will be used.
-
Method Details
-
setConfiguration
-
getLog
Retrieves the matching logger for this class.- Parameters:
clazz
- The class to get the logger for.- Returns:
- The logger.
-
setLogCreator
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
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.
-