title: log_file command not logging the output of a command in Expect script
body: <p>I'm running a debug command to log the output of my command to a file.I tried the log_file command but it doesnt log the output.My code is as follows:</p>
  
  <pre><code>log_file -a gdb.txt 
  send "~/debugulator.sh $file mns20\r"
  log_user 0
  expect -re {DSP.*0x[0-9][0-9][0-9][0-9]}
  log_user 1
  send_log $expect_out(0,string)
  log_file 
  </code></pre>
  
  <p>But when I open gdb.txt,nothing is inside.Can somebody tell me where exactly am I going wrong.The version of expect I'm using is 5.26.0</p>
  
  <p><strong>UPDATE</strong>
  Here is the other piece of code I was trying...It still doesnt work..I have posted the output after adding the exp_internal 1 command..The code is as follows:</p>
  
  <pre><code>spawn telnet 10.1.1.2
  expect "Login:"
  send "xyz\r"
  expect "Password:"
  send "Nxyz1\r"
  expect "xyz:/home/xyz&gt;"
  send "cd /sonus/support/GSX-[lindex $argv 0]\r"
  log_file myfile.log
  send_log "this is in the log file \n"
  log_file
  interact
  </code></pre>
  
  <p><strong>OUTPUT</strong>
      <code>spawn telnet 10.1.1.2</code>
      <code>parent: waiting for sync byte</code>
      <code>parent: telling child to go ahead</code>
      <code>parent: now unsynchronized from child</code>
      <code>spawn: returns {17179}</code></p>
  
  <pre><code>`expect: does "" (spawn_id exp6) match glob pattern "Login:"? no`
  `Trying 10.1.1.2...`
  
  `expect: does "Trying 10.1.1.2...\r\n" (spawn_id exp6) match glob pattern "Login:"? no`
  `Connected to 10.1.1.2.`
  `Escape character is '^]'.`
  
  `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape     character is '^]'.\r\n" (spawn_id exp6) match glob pattern "Login:"? no`
  
  
  `SunOS 5.9`
  
  
  `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\r" (spawn_id exp6) match glob pattern "Login:"? no
  login: xyz\r`
  `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: " (spawn_id exp6) match glob pattern "Login:"? no`
  `expect: timed out`
  `send: sending "xyz\r" to { exp6 }`
  
  `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: " (spawn_id exp6) match glob pattern "Password:"? no
  </code></pre>
  
  <p>xyz`</p>
  
  <pre><code> `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\n" (spawn_id exp6) match glob pattern "Password:"? no`
   `Password:` 
   `expect: does "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\nPassword: " (spawn_id exp6) match glob pattern "Password:"? yes`
   `expect: set expect_out(0,string) "Password:"`
   `expect: set expect_out(spawn_id) "exp6"`
   `expect: set expect_out(buffer) "Trying 10.1.1.2...\r\nConnected to 10.1.1.2.\r\nEscape character is '^]'.\r\n\r\n\r\nSunOS 5.9\r\n\r\r\n\rlogin: xyz\r\nPassword:"`
   `send: sending "Nxyz1\r" to { exp6 }`
  
   `expect: does " " (spawn_id exp6) match glob pattern "xyz:/home/xyz&gt;"? no`
  
  
   `expect: does " \r\n" (spawn_id exp6) match glob pattern "xyz:/home/xyz&gt;"? no`
   `Last login: Tue May 31 05:10:20 from 10.253.6.98
   /home/xyz/.aliases: No such file or directory.`
   `[1]slate:xyz:/home/xyz&gt;` 
   `expect: does " \r\nLast login: Tue May 31 05:10:20 from 10.253.6.98\r\n/home/xyz/.aliases: No such file or directory.\r\n\u001b]0;[slate:]/home/xyz\u0007[1]slate:\u001b[1mxyz\u001b[m:/home/xyz&gt; " (spawn_id exp6) `match      glob pattern "xyz:/home/xyz&gt;"? no
   `expect: timed out`
   `send: sending "cd /sonus/support/GSX-5\r" to { exp6 }`
   `tty_raw_noecho: was raw = 0  echo = 1`
   `spawn id exp6 sent &lt;c&gt;`
   `cspawn id exp6 sent &lt;d /sonus/support/GSX-5\r\r\n\u001b]0;[slate:]/sonus/support/GSX-5\u0007[2]slate:\u001b[1msdwarampudi\u001b[m:/sonus/support    /GSX-5&gt; &gt;`
   `/sonus/support/GSX-5`
  `[2]slate:xyz:/sonus/support/GSX-5&gt;` 
  </code></pre>