How do I log output message from console in Linux?
I am running a program under console. It keep outputting debug messa开发者_JS百科ges on screen. If do like this,
$./myProgram >> log.txt
then I cannot see the debug message on screen, all the messages are going to the log.txt.
So, how do I log the messages into log.txt and show the debug message on screen as well?
Thanks in advance.
Assuming you're logging to stdout:
$./myProgram | tee log.txt
EDIT
If you choose to log errors to stderr
then it might be useful to call you prog like this (stderr goes to one file, stdout goes to another file and to screen):
$./myProgram 2>error_log.txt | tee output_log.txt
tee. (Now a bunch of characters to make the 30 character limit)
精彩评论