TSTool / Command / StartLog
Overview
The StartLog
command (re)starts the log file.
It is useful to insert this command as the first command in a command file,
in order to persistently record the results of processing.
A useful standard is to name the log file the same as the command file, with an additional .log
extension,
and this convention is enforced by default.
A date or date/time can optionally be added to the log file name.
TSTool uses a startup log file in the .tstool/NN/logs
user files folder when the software starts,
where NN
is the TSTool major version.
Subsequently, all log messages will be written to the latest log file specified by StartLog
commands.
This allows, for example, log files to be created near the command file that was run.
If this behavior is not desirable, such as in automated testing,
use the ConfigureLogging
command to disable the StartLog
command.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax.
StartLog
Command Editor (see also the full-size image)
Command Syntax
The command syntax is as follows:
StartLog(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
LogFile required |
The name of the file to write. The extension of .log will automatically be added, if not specified. Can be specified using ${Property} . |
None - must be specified. |
MaxSize |
Maximum log file size in bytes, useful when the log file can be very large and the size needs to be restricted. | No limit to file size. |
Suffix |
Indicates that a suffix will be added before the .log extension, one of:
This is useful for automatically archiving logs corresponding to commands files, to allow checking the output at a later time. However, generating date/time stamped log files can increase the amount of disk space that is used. |
Examples
See the automated tests.
A sample command file to process State of Colorado HydroBase data is as follows
(the Add
command will generate an error because the units of the time series are incompatible):
StartLog(LogFile="Example_StartLog.log")
# 06753400 - LONETREE CREEK AT CARR, CO.
06753400.USGS.Streamflow.Month~HydroBase
# 1179 - BYERS 5 ENE
1179.NOAA.Precip.Month~HydroBase
Add(TSID="06753400.USGS.Streamflow.Month",AddTSList=AllTS,HandleMissingHow="IgnoreMissing")
Troubleshooting
See Also
ConfigureLogging
commandMessage
command - can be used to write messages to the log file