1 25 package com.mysql.jdbc.log; 26 27 import org.apache.log4j.Level; 28 import org.apache.log4j.Logger; 29 30 37 public class Log4JLogger implements Log { 38 39 private Logger logger; 40 41 public Log4JLogger(String instanceName) { 42 this.logger = Logger.getLogger(instanceName); 43 } 44 45 50 public boolean isDebugEnabled() { 51 return this.logger.isDebugEnabled(); 52 } 53 54 59 public boolean isErrorEnabled() { 60 return this.logger.isEnabledFor(Level.ERROR); 61 } 62 63 68 public boolean isFatalEnabled() { 69 return this.logger.isEnabledFor(Level.FATAL); 70 } 71 72 77 public boolean isInfoEnabled() { 78 return this.logger.isInfoEnabled(); 79 } 80 81 86 public boolean isTraceEnabled() { 87 return this.logger.isDebugEnabled(); 88 } 89 90 95 public boolean isWarnEnabled() { 96 return this.logger.isEnabledFor(Level.WARN); 97 } 98 99 104 public void logDebug(Object msg) { 105 this.logger.debug(LogUtils.expandProfilerEventIfNecessary(LogUtils 106 .expandProfilerEventIfNecessary(msg))); 107 } 108 109 115 public void logDebug(Object msg, Throwable thrown) { 116 this.logger.debug(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 117 } 118 119 124 public void logError(Object msg) { 125 this.logger.error(LogUtils.expandProfilerEventIfNecessary(msg)); 126 } 127 128 134 public void logError(Object msg, Throwable thrown) { 135 this.logger.error(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 136 } 137 138 143 public void logFatal(Object msg) { 144 this.logger.fatal(LogUtils.expandProfilerEventIfNecessary(msg)); 145 } 146 147 153 public void logFatal(Object msg, Throwable thrown) { 154 this.logger.fatal(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 155 } 156 157 162 public void logInfo(Object msg) { 163 this.logger.info(LogUtils.expandProfilerEventIfNecessary(msg)); 164 } 165 166 172 public void logInfo(Object msg, Throwable thrown) { 173 this.logger.info(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 174 } 175 176 181 public void logTrace(Object msg) { 182 this.logger.debug(LogUtils.expandProfilerEventIfNecessary(msg)); 183 } 184 185 191 public void logTrace(Object msg, Throwable thrown) { 192 this.logger.debug(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 193 } 194 195 200 public void logWarn(Object msg) { 201 this.logger.warn(LogUtils.expandProfilerEventIfNecessary(msg)); 202 } 203 204 210 public void logWarn(Object msg, Throwable thrown) { 211 this.logger.warn(LogUtils.expandProfilerEventIfNecessary(msg), thrown); 212 } 213 } 214 | Popular Tags |