How to redirect both stdout and stderr to a file
The simplest syntax to redirect both is:
command &> logfile
If you want to append to the file instead of overwrite:
command &>> logfile
You can do it like that 2>&1:
command > file 2>&1
If you want to log to the same file:
command1 >> log_file 2>&1
If you want different files:
command1 >> log_file 2>> err_file