package cn.com.qmhd.tools; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; public class Log { private static Logger logger = Logger.getLogger(Log.class.getName()); private static Log log = null; public static Log getInstance(){ if(log == null){ log = new Log(); } return log; } Log() { PropertyConfigurator.configure(Log.class.getClassLoader().getResource( "").getFile() + "config/log4j.properties"); } public void printWran(String className, String strWran) { logger.warn("["+className+"]"+strWran); } public void printInfo(String className, String strInfo) { logger.info("["+className+"]"+strInfo); } public void printError(String className,String strError) { logger.error("["+className+"]"+strError); } public void printDebug(String className, String strDebug) { logger.debug("["+className+"]"+strDebug); } }