Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats the best way to LOG an entire script execution?

Status
Not open for further replies.

LilTCLer

Programmer
Nov 27, 2007
37
US
I have a large expect script that installs and initializes software on various networking equipment. Within the script, there are many places where user input and system output is recognized. I would like to be able to create a logfile of the entire session so i can save it. I can't figure out what is the best way to do it. I execute from UNIX.

I've tried to figure out how to use the UNIX "script -a <logfile>" to work from within my expect script, but have had no luck.

I'm also attempting to create a procedure to write everything to an output file, but I think this is going to be a mess because of duplicate data - i.e. when I match system output via expect, I would write the expect_out(buffer) to the log, but it will most likely write duplicates of what was already written from stdout.

Any ideas here?
 
There is a logger package in TclLib but it's probably just as much effort to get it to do what you want as it would be to just do it manually. Depending on what you want to log, I think I'd accumulate the messages in either a list or, if you want to reference each message to some key so as to overwrite old data, an array.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top