All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.logging.LogFactory Maven / Gradle / Ivy

There is a newer version: 4.29.2
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy