public boolean initAll() { if (initLog()) { GlobalStaticVar.BusinessLog.info("初始化日志完成!"); } else { System.out.println("初始化日志失败!"); return false; } initProp(); initDb(); initTask(); return true; }
/** 初始化日志 */ public boolean initLog() { Properties props = new Properties(); InputStream in = InitProxy.class.getClassLoader().getResourceAsStream("log4j.properties"); try { props.load(in); PropertyConfigurator.configure(props); GlobalStaticVar.BusinessLog = Logger.getLogger("BusinessLog"); GlobalStaticVar.ExceptionLog = Logger.getLogger("ExceptionLog"); GlobalStaticVar.BusinessLog.info("日志初始化成功."); } catch (IOException e) { return false; } finally { try { if (in != null) in.close(); } catch (IOException e) { return false; } finally { in = null; } } return true; }