in reply to How to log all output from a program?
(perl -le 'print "foo"; print STDERR "bar"' | sed 's,^,OUT ,' | tee -a + log.stdout ) 2>&1 1>/dev/tty | sed 's,^,ERR ,' | tee -a log.stderr
Of course that doesn't work if there's no tty.
update: replace /dev/tty with /dev/null in that case. Or better, if you don't need output to the terminal
(perl -le 'print "foo"; print STDERR "bar"' | sed 's,^,OUT ,') 2>&1 1> +>log.stdout | sed 's,^,ERR ,' >> log.stderr
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to log all output from a program?
by salva (Canon) on Oct 15, 2007 at 08:25 UTC | |
by shmem (Chancellor) on Oct 15, 2007 at 08:50 UTC | |
by salva (Canon) on Oct 15, 2007 at 09:10 UTC | |
by salva (Canon) on Oct 16, 2007 at 21:42 UTC |