You are not logged in.
I'm using a program that produces a log file and also writes debug information to stderr.
I'd like to merge the two outputs in real time so that I can see everything in the same place. Is there a way to do that?
Thanks.
Edit: I actually want to save the output, not see it in real time...
Last edited by stqn (2011-10-29 03:18:09)
Offline
What happens if you redirect stderr to the log and view the log with 'tail -f'?
Edit:
multitail -I file1 -I file2
seems to work.
# pacman -S multitail
Last edited by karol (2011-10-29 01:50:31)
Offline
I've tried your first idea and it almost works. If I run the program like this:
program 2>>program.log
Then I can get the mix with:
tail -f program.log >new.log
But unfortunately every time something is output to stderr, it swallows a bit of the original log (some text is missing.)
On the other hand, multitail looks quite awesome . Unfortunately, I can't make it save the output to a file... Options "-a" and "-A" are supposed to do it, but it only creates an empty file.
Offline
You create an empty file
touch foo
and redirect the output of the command to it
somecommand > foo
(just one '>')
multitail -I foo -I /var/log/pacman.log
seems to work.
Edit: Ah, I get what you want now. I'll check the -a / -A part.
Last edited by karol (2011-10-29 02:32:15)
Offline
Yeah maybe it wasn't clear that I want to save the merged logs in order to be able to examine all of it later. I didn't mention that at all, in fact .
Offline
Try
multitail -a outputfile -I file1 -a outputfile -I file2
file1 and file2 are the log and stderr and the outputfile is what you can view later - both sources interleaved with each other., just like when you view them with multitail.
Last edited by karol (2011-10-29 02:54:49)
Offline
Yes, it's working! I was simply adding "-a file" at the end of the command line but that only produces an empty file. The man page doesn't mention that "-a" has to be used before each input file...
Thanks a lot for your help . This will be very helpful to see what's going on and improve the program.
Offline