The following writes stdout to a logfile and prints stderr:
bash script.sh >> out.log
bash script.sh >> out.log 2>&1
bash script.sh 2>&1 >> out.log | tee -a out.log
First, I'm redirecting stdout to file and stderr to stdout (stdout line gets to the out.log file and stderr to pipe).
tee command prints stdin to both stdout and file (resemblance with the letter T). Thus second, I'm printing the original stderr to both stdout and the out.log file (the
-a argument means append).