From charlesreid1

Tee is a utility for redirecting output to files while also printing to the screen

To redirect standard out and standard error to tee, and have them both show up in the file, use this:

command 2>&1 | tee out.file