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 LogRetrieves the matching logger for this class.static LogLevelstatic booleanstatic booleanstatic booleanstatic voidsetConfiguration(Configuration configuration) static voidsetFallbackLogCreator(LogCreator fallbackLogCreator) Sets the fallback LogCreator.static voidsetJsonLogsEnabled(boolean jsonLogsEnabled) static voidsetLogCreator(LogCreator logCreator) Sets the LogCreator that will be used.static voidsetLogLevel(LogLevel logLevel)
-
Method Details
-
isDebugEnabled
public static boolean isDebugEnabled() -
isQuietMode
public static boolean isQuietMode() -
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.
-
getLogLevel
-
setLogLevel
-
isJsonLogsEnabled
public static boolean isJsonLogsEnabled() -
setJsonLogsEnabled
public static void setJsonLogsEnabled(boolean jsonLogsEnabled)
-