• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Digital Design
  3. Encounter How-To: Write Text to The Log File With "Puts…
BobD
BobD

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
CDNS - RequestDemo

Have a question? Need more information?

Contact Us
EDI system
Digital Implementation
Encounter Digital Implementation
tcl

Encounter How-To: Write Text to The Log File With "Puts"

30 Oct 2009 • 1 minute read

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"
hi

-or-

encounter 64> set outfile [open test "w"]
file18
encounter 65> puts $outfile "hi"
encounter 66> close $outfile
encounter 67> more test
hi


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
encounter.log207

...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"
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
hi

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.

Bob Dwyer


CDNS - RequestDemo

Try Cadence Software for your next design!

Free Trials

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information