Redirect System.out.println to log

前端 未结 5 1315
孤城傲影
孤城傲影 2021-01-11 15:51

In my project test suite there is big usage of

System.out.println 

I\'m trying to redirect these output to log file (through configuration

5条回答
  •  花落未央
    2021-01-11 16:43

    Use shell redirection. Figure out the "java" invocation for your project, if you're on most vaguely UNIX-like systems, ps aux | grep java will help.

    Then just run this command with > /path/to/logfile. Example:

    java -jar myjar.jar -cp path/to/lib.jar:path/to/otherlib.jar com.bigcorp.myproject.Main > /var/log/myproject.log
    

提交回复
热议问题