Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 08-12-2009, 04:41 AM
samoki samoki is offline
Registered User
Join Date: Jun 2006
Posts: 24
How to record session to defferent log files when script is running?

I want to record session to different log files,one record session,some special output need to record to another log file.Can I change log file when script is running?How can I carry out it?
Reply With Quote
Old 08-12-2009, 12:32 PM
bgagnon bgagnon is offline
VanDyke Technical Support
Join Date: Oct 2008
Posts: 4,633
Hi samoki,

You can include logging to two separate files in your script. Assuming logging is currently set to 'True' to log the session, you would need to perform the following steps:
  1. Stop logging to "old_logfile"
  2. Save "old_logfile" filename in a variable
  3. Specify a new filename for the logging of the "special output"
  4. Start logging to "new_logfile"
  5. Issue the desired command for which you wish to capture the "special output"
  6. Stop logging to "new_logfile"
  7. If desired, restart logging to "old_logfile"
The code snippet would look similar to below:
crt.Session.Log False
strOrigLogFile = crt.Session.LogFileName
crt.Session.LogFileName = "C:\new_logfile.txt"
crt.Session.Log True, True
crt.Screen.Send "desired command"
crt.Screen.WaitForString "my prompt"
crt.Session.Log False
crt.Session.LogFileName = strOrigLogFile
crt.Session.Log True, True
Using the above information, are you able to log to two separate files?

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote
Old 08-12-2009, 06:54 PM
samoki samoki is offline
Registered User
Join Date: Jun 2006
Posts: 24
Thanks.I'll try it.
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 07:37 PM.