Source: stackoverflow: How do I write stderr to a file while using “tee” with a pipe?
sh test.sh 2>&1 | tee "test.log"