Here's a simple but useful tip that shows how to write to the log file using the Encounter command "Puts"...
In TCL, the "puts" command is use to write information to the console -or- to a file. For example:
encounter 63> puts "hi"
encounter 64> set outfile [open test "w"]
encounter 65> puts $outfile "hi"
encounter 66> close $outfile
encounter 67> more test
But, how do you write information to the log file? Although it's possible to get the name of the current log file (and that's a useful tip in itself):
encounter 68> getLogFileName
...it's not clear how to get the handle of the log file so that we can write to it with puts. It turns out- you don't need to because there's a special built-in command called "Puts" (note the capital "P") that writes to the screen -and- to the log file:
encounter 69> Puts "hi"
Note: that the string is still written to the console.
Note: too that the string is written to the log file:
encounter 70> tail -1 encounter.log207
Writing to the log file can be particularly useful when troubleshooting a script and you want to write checkpoint statements that you can later search for using a text editor.
I hope this is useful.