Home > Community > Blogs > Digital Implementation > Encounter How-To: Write Text to The Log File With "Puts"
 
Login with a Cadence account.
Not a member yet?
Create a permanent login account to make interactions with Cadence more conveniennt.

Register | Membership benefits
Get email delivery of the Digital Implementation blog (individual posts).
 

Share

  • Email
  • Social Web
* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

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

Comments(3)Filed under: Digital Implementation, Encounter Digital Implementation, TCL, EDI system

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

Comments(3)

By jgentry on October 30, 2009
Bob, any guidance on how to flush the log and cmd channels? Often times I want to repeat a GUI type command (i.e. zoomBox) but have to wait for the file buffers to dump.

Thx,
JG

By BobD on October 31, 2009
I did some exploration in this space with another user just recently, and what we found was that it was an NFS caching issue. If we were looking at the log file on a different machine than the job was running on, it would take a certain quantity of data in the log file before it appeared on the disk where we were looking at the log file.

Is that the situation in your run environment too? What I've been doing sometimes is brining up an xterm on the machine I'm running on, or the log file viewer from within the tool.

I was unable to determine a way to force an nfs flush from within Encounter.

By eminemshow on November 1, 2009
Thanks bob, the command 'Put' is cool, very easy & useful.



Leave a Comment


Name
E-mail (will not be published)
Comment
 I have read and agree to the Terms of use and Community Guidelines.
Community Guidelines
The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.