I thank you for the code, and will try to figure out how to work with it, but it doesn't quite handle what I requested. I tested it against a dummied up script that I know will both produce successful output, and fail at the end. After the run, I ended up with a file log.1 which contained only the successful (stdout) output, and two identical files log.stderr.1 and log.stderr.2 which contained only the stderr output. Attempting to restore the stdout stream by removing the log.1 reference instead created two log.stderr files, again identical, which contained all of stderr followed by all of stdout, rather than interleaved. (Presumably this was the result of the piped call to tee, as an attempt to run without that but with the solo 2>&1 showed them in the originally expected order on the screen.)
What was the expected result of that code snippet? Would it have been log.stderr.1 with everything, and log.stderr.2 with only the stderr output, or vice versa?