I tend to put the 2>&1 BEFORE the | tee output.txt to capture the stderr into the file. I don't see how that is being accomplished this way. Is that not the intent?