Redirecting program errors to both log and error file
- by Gnanam
I've a Java standalone program scheduled to run as cron at every 10 minutes
I want to catch/write errors thrown by this Java program both in the log file
and also as a separate error file (MyJavaStandalone.err).
I know the following commands:
Errors redirected to a separate file but not to log file
/usr/java/jdk1.6.0/bin/java MyJavaStandalone >> MyJavaStandalone.log 2>> MyJavaStandalone.err &
Both log and errors are redirected to the same log file, but errors alone are not written to a separate error file
/usr/java/jdk1.6.0/bin/java MyJavaStandalone >> MyJavaStandalone.log 2>&1 &