output to log file and error to log error

C++
./ShellFile.sh >& pathToLogFile.log
Source

Also in C++: