program [arguments...] 2>&1 | tee -a outfile
stdbuf -o 0 myprogram [myarguments...] 2>&1 | tee outfile #stdbuf prevents buffering