comparison src/goodjava/logging/Log4jFactory.java @ 1448:6fc083e1d08c

start logger
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 Feb 2020 18:14:32 -0700
parents 27efb1fcbcb5
children
comparison
equal deleted inserted replaced
1447:851b9a48cc44 1448:6fc083e1d08c
1 package goodjava.logging; 1 package goodjava.logging;
2 2
3 3
4 public final class Log4jFactory extends LoggerFactory { 4 public final class Log4jFactory implements ILoggerFactory {
5 private static final class Log4jLogger implements Logger { 5 private static final class Log4jLogger implements Logger {
6 final org.apache.log4j.Logger log4j; 6 final org.apache.log4j.Logger log4j;
7 7
8 Log4jLogger(org.apache.log4j.Logger log4j) { 8 Log4jLogger(org.apache.log4j.Logger log4j) {
9 this.log4j = log4j; 9 this.log4j = log4j;
31 31
32 @Override public void info(String msg,Throwable t) { 32 @Override public void info(String msg,Throwable t) {
33 log4j.info(msg,t); 33 log4j.info(msg,t);
34 } 34 }
35 35
36 @Override public boolean isInfoEnabled() {
37 return log4j.isInfoEnabled();
38 }
39
36 @Override public void debug(String msg) { 40 @Override public void debug(String msg) {
37 log4j.debug(msg); 41 log4j.debug(msg);
38 } 42 }
39 43
40 @Override public void debug(String msg,Throwable t) { 44 @Override public void debug(String msg,Throwable t) {
41 log4j.debug(msg,t); 45 log4j.debug(msg,t);
42 } 46 }
47
48 @Override public boolean isDebugEnabled() {
49 return log4j.isDebugEnabled();
50 }
43 } 51 }
44 52
45 @Override protected Logger getLoggerImpl(Class cls) { 53 @Override public Logger getLogger(String name) {
46 return new Log4jLogger(org.apache.log4j.Logger.getLogger(cls));
47 }
48
49 @Override protected Logger getLoggerImpl(String name) {
50 return new Log4jLogger(org.apache.log4j.Logger.getLogger(name)); 54 return new Log4jLogger(org.apache.log4j.Logger.getLogger(name));
51 } 55 }
52 } 56 }