liquibase.logging.LogFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
package liquibase.logging;
import liquibase.exception.ServiceNotFoundException;
import liquibase.servicelocator.ServiceLocator;
import java.util.HashMap;
import java.util.Map;
public class LogFactory {
private static Map loggers = new HashMap();
private static String defaultLoggingLevel = "info";
public static Logger getLogger(String name) {
if (!loggers.containsKey(name)) {
Logger value;
try {
value = (Logger) ServiceLocator.getInstance().newInstance(Logger.class);
} catch (Exception e) {
throw new ServiceNotFoundException(e);
}
value.setName(name);
value.setLogLevel(defaultLoggingLevel);
loggers.put(name, value);
}
return loggers.get(name);
}
public static Logger getLogger() {
return getLogger("liquibase");
}
public static void setLoggingLevel(String defaultLoggingLevel) {
LogFactory.defaultLoggingLevel = defaultLoggingLevel;
}
}