本文共 576 字,大约阅读时间需要 1 分钟。
private void writeMessageToDisk(String returnJson) { try { String beforePath = Config.getContextRealPath() + "monitorLog/"; String savePath = beforePath + "express.txt"; File file = new File(beforePath); if (!file.exists()) { file.mkdirs(); } OutputStreamWriter write = new OutputStreamWriter( new FileOutputStream(savePath, true), "gbk"); BufferedWriter writer = new BufferedWriter(write); writer.write(new Date() + "------" + returnJson + "\t\n"); writer.close(); } catch (Exception e) { System.out.println("****************写入错误******************"); e.printStackTrace(); } }转载地址:http://uwqgi.baihongyu.com/