1 package org.apache.turbine.util; 2 3 18 19 import org.apache.commons.logging.LogFactory; 20 import org.apache.turbine.TurbineConstants; 21 22 32 public class Log 33 { 34 40 public static org.apache.commons.logging.Log getLogger() 41 { 42 return LogFactory.getLog(TurbineConstants.DEFAULT_LOGGER); 43 } 44 45 52 public static org.apache.commons.logging.Log getLogger(String logName) 53 { 54 org.apache.commons.logging.Log log = LogFactory.getLog(logName); 55 56 if (log == null) 57 { 58 log = getLogger(); 59 } 60 return log; 61 } 62 63 69 public static void debug(String message) 70 { 71 getLogger().debug(message); 72 } 73 74 80 public static void debug(String message, Throwable t) 81 { 82 getLogger().debug(message, t); 83 } 84 85 91 public static void debug(String logName, String message, Throwable t) 92 { 93 getLogger(logName).debug(message, t); 94 } 95 96 102 public static void debug(String logName, String message) 103 { 104 getLogger(logName).debug(message); 105 } 106 107 113 public static void info(String message) 114 { 115 getLogger().info(message); 116 } 117 118 124 public static void info(String message, Throwable t) 125 { 126 getLogger().info(message, t); 127 } 128 129 135 public static void info(String logName, String message) 136 { 137 getLogger(logName).info(message); 138 } 139 140 146 public static void info(String logName, String message, Throwable t) 147 { 148 getLogger(logName).info(message, t); 149 } 150 151 157 public static void warn(String message) 158 { 159 getLogger().warn(message); 160 } 161 162 168 public static void warn(String message, Throwable t) 169 { 170 getLogger().warn(message, t); 171 } 172 173 179 public static void warn(String logName, String message) 180 { 181 getLogger(logName).warn(message); 182 } 183 184 190 public static void warn(String logName, String message, Throwable t) 191 { 192 getLogger(logName).warn(message, t); 193 } 194 195 201 public static void error(String message) 202 { 203 getLogger().error(message); 204 } 205 206 212 public static void error(String message, Throwable t) 213 { 214 getLogger().error(message, t); 215 } 216 217 223 public static void error(String logName, String message) 224 { 225 getLogger(logName).error(message); 226 } 227 228 234 public static void error(String logName, String message, Throwable t) 235 { 236 getLogger(logName).error(message, t); 237 } 238 239 245 public static void error(Throwable e) 246 { 247 error("", e); 248 } 249 } 250 | Popular Tags |