package com.jinguan.db;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
public class ConsoleToFile {
public static void main(String[] args) {
File file = new File("console.log");
try {
file.createNewFile();
FileOutputStream out = new FileOutputStream(file);
PrintStream stream = new PrintStream(out);
System.setOut(stream);
System.out.println("控制台的信息打印到当前文本了");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
将控制台的日志输出到外部文件
最新推荐文章于 2024-07-14 03:13:50 发布