public static void init() throws IOException { String fileName = LogUtil.caluFileName(Log2FileConf.errRecordDir, Log2FileConf.errFileName); File file = LogUtil.getLogFile(fileName, false); while (file.exists()) { fileName = fileName + ".bak"; file = new File(fileName); } currFileName = fileName; bfw = LogUtil.getNewBufferedWriter(fileName); }
private static BufferedWriter getBufferedWriter() throws IOException { String fileName = LogUtil.caluFileName(Log2FileConf.errRecordDir, Log2FileConf.errFileName); if (fileName.split("\\.")[1].equals(currFileName.split("\\.")[1])) { return bfw; } bfw.flush(); bfw.close(); currFileName = fileName; bfw = LogUtil.getNewBufferedWriter(currFileName); return bfw; }