Advanced Logging

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Debugging, Logging and Troubleshooting >

Advanced Logging

 

Enable Script-Specific Log Files

The default Script Log and Trace Log files are appended to with new logging information each time the Robo-FTP application is launched. If you run multiple command scripts you should use script-specific logging because otherwise it can be inconvenient to isolate a problem if you need to troubleshoot something with your script. Script-specific logging is enabled by using the LOG and TRACELOG commands and supplying a unique [ file name ] argument for each script. For ease of troubleshooting we recommend that every script file begin with the LOG and TRACELOG commands. For example, a script that automates the process of downloading files from the Acme Brick company might begin like this:

 

LOG "AcmeDownload_script.log"

TRACELOG "AcmeDownload_trace.log"

 

By specifying a different file name for each command script, you can be sure that each log file will be overwritten only by a subsequent execution of the same script. The LOG and TRACELOG commands also have options that allow log files to be appended instead of overwritten, for creating a new unique log file for each execution and for enforcing a maximum log size via log rotation.

 

 

Developing and debugging new scripts

Although the log files are vital for troubleshooting new problems that appear in existing script, they are probably most often used during the process of developing and debugging new command scripts. The LOG and TRACELOG commands both offer the /new option that allows you to create a new log file for each script execution. This behavior is especially useful if you tend to debug scripts by testing multiple minor changes over a relatively short period of time because you can later go back and study the effect of each change individually.

 

Another troubleshooting trick is to write the value of every variable to the Script Log by simply calling the DISPLAY command without the [ variable ] argument. Reviewing the state of all of your variables often reveals the underlying cause of errant script behavior.

 

 

Maintaining existing automation jobs

It is a good idea to enable logging on all of your Robo-FTP jobs. Even scripts that have been running reliably for years are susceptible to failure due to external changes to the firewall, server or network. When a script is configured to run multiple times overnight or over the weekend it is a good idea to use the /maxsize and /append options together to capture multiple executions. This will allow you to trouble shoot transient problems that may occur during off hours.

 

Controlling logging output

It is possible to suppress individual lines of script without disabling the entire Script Log. You may wish to do this to keep login credentials private or simply to make code comments easier to ignore while debugging. Conversely, it is also possible to use the LOGMSG command to insert additional rows of text into the Script Log.

 

 

Related command(s): LOG, TRACELOG

See also: Basic Logging, Debug Logging, Troubleshooting, Interactive Debugging