view src/goodjava/logging/Log4jFactory.java @ 1450:28b1ddacfad3

logger work
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 01 Mar 2020 13:47:02 -0700
parents 6fc083e1d08c
children
line wrap: on
line source

package goodjava.logging;


public final class Log4jFactory implements ILoggerFactory {
	private static final class Log4jLogger implements Logger {
		final org.apache.log4j.Logger log4j;

		Log4jLogger(org.apache.log4j.Logger log4j) {
			this.log4j = log4j;
		}

		@Override public void error(String msg) {
			log4j.error(msg);
		}

		@Override public void error(String msg,Throwable t) {
			log4j.error(msg,t);
		}

		@Override public void warn(String msg) {
			log4j.warn(msg);
		}

		@Override public void warn(String msg,Throwable t) {
			log4j.warn(msg,t);
		}

		@Override public void info(String msg) {
			log4j.info(msg);
		}

		@Override public void info(String msg,Throwable t) {
			log4j.info(msg,t);
		}

		@Override public boolean isInfoEnabled() {
			return log4j.isInfoEnabled();
		}

		@Override public void debug(String msg) {
			log4j.debug(msg);
		}

		@Override public void debug(String msg,Throwable t) {
			log4j.debug(msg,t);
		}

		@Override public boolean isDebugEnabled() {
			return log4j.isDebugEnabled();
		}
	}

	@Override public Logger getLogger(String name) {
		return new Log4jLogger(org.apache.log4j.Logger.getLogger(name));
	}
}