How can we redirect a Java program console output to multiple files?

后端 未结 5 414
忘掉有多难
忘掉有多难 2020-11-28 20:36

How can we redirect the eclipse console output to a file? I can:

  1. Run Configuration->Commons->Select a file.
  2. Use
5条回答
  •  孤城傲影
    2020-11-28 20:43

    You could use a "variable" inside the output filename, for example:

    /tmp/FetchBlock-${current_date}.txt
    

    current_date:

    Returns the current system time formatted as yyyyMMdd_HHmm. An optional argument can be used to provide alternative formatting. The argument must be valid pattern for java.util.SimpleDateFormat.

    Or you can also use a system_property or an env_var to specify something dynamic (either one needs to be specified as arguments)

提交回复
热议问题