in reply to Logging details to log file

If you are using send method to send strings then those strings will be echoed to the STDOUT unless you change the pty to raw mode.

--- From the Expect POD ---
$object->send(@strings)

Sends the given strings to the spawned command. Note that the strings are not logged in the logfile (see print_log_file) but will probably be echoed back by the pty, depending on pty settings (default is echo) and thus end up there anyway. This must also be taken into account when expect()ing for an answer: the next string will be the command just sent. I suggest setting the pty to raw, which disables echo and makes the pty transparently act like a bidirectional pipe.