I want the output of expect script to go into a log file.It seems pretty easy to do with log_file
command but the problem is that i just want the output to go to the log file.
when i do
log_user 0
log_file nameoflogfile
the log file gets created with it contents but output is also diplayed on the screen.how do i suppress the output comming to stdout.
If I understood you correctly you need to write log_file -a the-log-file
here. According to the Expect manual:
The
−a
flag forces output to be logged that was suppressed by thelog_user
command.
By the way, outputs generated by the puts
commands would not be sent to the log file created by log_file
. You may consider using send_*
commands (like send_user
) instead of puts
.