How do I get java to output to a log when run from a batch?

后端 未结 1 1949
灰色年华
灰色年华 2021-02-09 23:35

I have a java file called \"Ares.jar\" that runs every 5 minutes via windows scheduled tasks, the batch calls:

java -jar Ares.jar >> Ares.log  

1条回答
  •  臣服心动
    2021-02-10 00:03

    java -jar Ares.jar > Ares.log 2>&1 
    

    The second part of this command will redirect stderr to stdout, ensuring that both appear in the same file.

    If you want regular logs and error logs in separate files, just use:

    java -jar Ares.jar > Ares.log 2>Ares.error.log
    

    You can get the full details of everything that is possible in the documentation, available from Microsoft: http://technet.microsoft.com/en-us/library/bb490982.aspx

    0 讨论(0)
提交回复
热议问题