I also use Caffe. You can try
sh train_imagenet.sh 2>&1 | tee output.txt
You can also add the -i option to tee to ignore Ctrl-C (which passes the SIGINT signal to train_imagenet.sh instead of tee)
sh train_imagenet.sh 2>&1 | tee -i output.txt
BTW, glog . , stdout stderr.
, glog "/tmp/< > . < a > . < > .log. < > . <date> . <time> . <PID> " (, "/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474" ).
glog ERROR FATAL (stderr) .
GLOG_log_dir log_dir ( gflags). . https://godoc.org/github.com/golang/glog.