ECLIPSE控制台信息导出

JAVA代码:

String fileAddress = Config.get_storeServiceLogsAsTextFile(); //获取信息的存放位置
//将控制台的信息保存到特定的文件中
PrintStream out = System.out;
PrintStream ps = null;
try {
  ps = new PrintStream(fileAddress);

  System.setOut(ps);
} catch (FileNotFoundException e1) {
  e1.printStackTrace();
}

System.out.println(" 启动开始。。。");

。。。

System.out.println(" 启动结束。。。");

System.setOut(out); 

运行后,没运行一次文件中信息就会刷新一次

 对于通过Eclipse设置的情况,可取别处查询

猜你喜欢

转载自www.cnblogs.com/Stir-friedEggplant/p/9441974.html