system.out.println redirection in java

前端 未结 3 632
时光取名叫无心
时光取名叫无心 2021-01-26 11:28

I want to catch the println and redirect to a file and print it

here is my code, I wish to print 123 /n 456

but that doesn\'t work and I think I need something t

3条回答
  •  我在风中等你
    2021-01-26 12:00

    You should redirect the out stream to a file like this:

     System.setOut(new PrintStream(new File(""));
    

    this will redirect all your system.out in the log file. hope this helps.

提交回复
热议问题