linux

System.setOut(new PrintStream(new File("/opt/apache-tomcat-8.5.51/logs/outLog.txt")));
System.out.println("输出到日志文件测试");

 

windows

System.setOut(new PrintStream(new File("D:/logs/outLog.txt")));
System.out.println("输出到日志文件测试");

 

相关文章: