web项目读取日志文件
//得到路径 String appPath = filterConfig.getServletContext().getRealPath("/"); // 获取downLoadLog.txt文件 File logFile = new File(appPath, "downloadLog.txt"); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } }