1 52 53 package freemarker.log; 54 55 import org.apache.log4j.Level; 56 57 61 class Log4JLoggerFactory implements LoggerFactory 62 { 63 public Logger getLogger(String category) 64 { 65 return new Log4JLogger(org.apache.log4j.Logger.getLogger(category)); 66 } 67 68 private static class Log4JLogger 69 extends 70 Logger 71 { 72 private final org.apache.log4j.Logger logger; 73 74 Log4JLogger(org.apache.log4j.Logger logger) 75 { 76 this.logger = logger; 77 } 78 79 public void debug(String message) 80 { 81 logger.debug(message); 82 } 83 84 public void debug(String message, Throwable t) 85 { 86 logger.debug(message, t); 87 } 88 89 public void error(String message) 90 { 91 logger.error(message); 92 } 93 94 public void error(String message, Throwable t) 95 { 96 logger.error(message, t); 97 } 98 99 public void info(String message) 100 { 101 logger.info(message); 102 } 103 104 public void info(String message, Throwable t) 105 { 106 logger.info(message, t); 107 } 108 109 public void warn(String message) 110 { 111 logger.warn(message); 112 } 113 114 public void warn(String message, Throwable t) 115 { 116 logger.warn(message, t); 117 } 118 119 public boolean isDebugEnabled() 120 { 121 return logger.isDebugEnabled(); 122 } 123 124 public boolean isInfoEnabled() 125 { 126 return logger.isInfoEnabled(); 127 } 128 129 public boolean isWarnEnabled() 130 { 131 return logger.isEnabledFor(Level.WARN); 132 } 133 134 public boolean isErrorEnabled() 135 { 136 return logger.isEnabledFor(Level.ERROR); 137 } 138 139 public boolean isFatalEnabled() 140 { 141 return logger.isEnabledFor(Level.FATAL); 142 } 143 } 144 } 145 | Popular Tags |