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

liquibase.logging.core.JavaLogger Maven / Gradle / Ivy

There is a newer version: 4.29.2
Show newest version
package liquibase.logging.core;

import liquibase.logging.LogMessageFilter;

import java.util.logging.Level;

/**
 * The default logger for Liquibase. Routes messages through {@link java.util.logging.Logger}.
 */
public class JavaLogger extends AbstractLogger {

    private final String className;
    private java.util.logging.Logger logger;

    public JavaLogger(java.util.logging.Logger logger, LogMessageFilter filter) {
        super(filter);
        this.logger = logger;
        this.className = logger.getName();
    }

    @Override
    public void log(Level level, String message, Throwable e) {
        if (level.equals(Level.OFF)) {
            return;
        }

        if (!logger.isLoggable(level)) {
            return;
        }
        logger.logp(level, className, null, filterMessage(message), e);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy