1 package xdoclet.modules.ojb; 2 3 17 18 import org.apache.commons.logging.Log; 19 import org.apache.commons.logging.LogFactory; 20 21 26 public class LogHelper 27 { 28 37 public static void debug(boolean alsoStdout, Class clazz, String posInfo, Object msg) 38 { 39 if (alsoStdout) 40 { 41 System.out.println(msg.toString()); 42 } 43 44 String name = clazz.getName(); 45 46 if (posInfo != null) 47 { 48 name += "." + posInfo; 49 } 50 51 Log log = LogFactory.getLog(name); 52 53 if (log.isDebugEnabled()) 54 { 55 log.debug(msg); 56 } 57 } 58 59 68 public static void warn(boolean alsoStdout, Class clazz, String posInfo, Object msg) 69 { 70 if (alsoStdout) 71 { 72 System.out.println("Warning: "+msg.toString()); 73 } 74 75 String name = clazz.getName(); 76 77 if (posInfo != null) 78 { 79 name += "." + posInfo; 80 } 81 82 Log log = LogFactory.getLog(name); 83 84 if (log.isWarnEnabled()) 85 { 86 log.warn(msg); 87 } 88 } 89 } 90 | Popular Tags |