1 16 17 18 package org.apache.commons.logging.impl; 19 20 import java.io.Serializable ; 21 import org.apache.log.Logger; 22 import org.apache.log.Hierarchy; 23 import org.apache.commons.logging.Log; 24 25 39 40 public class LogKitLogger implements Log, Serializable { 41 42 43 45 46 47 protected transient Logger logger = null; 48 49 50 protected String name = null; 51 52 53 55 56 62 public LogKitLogger(String name) { 63 this.name = name; 64 this.logger = getLogger(); 65 } 66 67 68 70 71 74 public Logger getLogger() { 75 76 if (logger == null) { 77 logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name); 78 } 79 return (logger); 80 81 } 82 83 84 86 87 93 public void trace(Object message) { 94 debug(message); 95 } 96 97 98 105 public void trace(Object message, Throwable t) { 106 debug(message, t); 107 } 108 109 110 116 public void debug(Object message) { 117 if (message != null) { 118 getLogger().debug(String.valueOf(message)); 119 } 120 } 121 122 123 130 public void debug(Object message, Throwable t) { 131 if (message != null) { 132 getLogger().debug(String.valueOf(message), t); 133 } 134 } 135 136 137 143 public void info(Object message) { 144 if (message != null) { 145 getLogger().info(String.valueOf(message)); 146 } 147 } 148 149 150 157 public void info(Object message, Throwable t) { 158 if (message != null) { 159 getLogger().info(String.valueOf(message), t); 160 } 161 } 162 163 164 170 public void warn(Object message) { 171 if (message != null) { 172 getLogger().warn(String.valueOf(message)); 173 } 174 } 175 176 177 184 public void warn(Object message, Throwable t) { 185 if (message != null) { 186 getLogger().warn(String.valueOf(message), t); 187 } 188 } 189 190 191 197 public void error(Object message) { 198 if (message != null) { 199 getLogger().error(String.valueOf(message)); 200 } 201 } 202 203 204 211 public void error(Object message, Throwable t) { 212 if (message != null) { 213 getLogger().error(String.valueOf(message), t); 214 } 215 } 216 217 218 224 public void fatal(Object message) { 225 if (message != null) { 226 getLogger().fatalError(String.valueOf(message)); 227 } 228 } 229 230 231 238 public void fatal(Object message, Throwable t) { 239 if (message != null) { 240 getLogger().fatalError(String.valueOf(message), t); 241 } 242 } 243 244 245 248 public boolean isDebugEnabled() { 249 return getLogger().isDebugEnabled(); 250 } 251 252 253 256 public boolean isErrorEnabled() { 257 return getLogger().isErrorEnabled(); 258 } 259 260 261 264 public boolean isFatalEnabled() { 265 return getLogger().isFatalErrorEnabled(); 266 } 267 268 269 272 public boolean isInfoEnabled() { 273 return getLogger().isInfoEnabled(); 274 } 275 276 277 280 public boolean isTraceEnabled() { 281 return getLogger().isDebugEnabled(); 282 } 283 284 285 288 public boolean isWarnEnabled() { 289 return getLogger().isWarnEnabled(); 290 } 291 292 293 } 294 | Popular Tags |