阅读背景:

解惑tomcat如何将标准输出保存到文件——重定向System.out

来源:互联网 

看代码就懂:

package com.xs.test;

import java.io.FileOutputStream;
import java.io.PrintStream;

public class Test {
	public static void main(String[] args) throws Exception {
		String outPath = "C:\out.log";
		System.setOut(new PrintStream(new FileOutputStream(outPath, true)));
		System.out.println("Hello world!");
	}
}
package com.xs.test;

import java.io.F



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: