Spool on/off

Log the output of a MaxL Shell session to a file. Send standard output, informational messages, error messages, and/or warning messages generated by the execution of MaxL statements to a file.

If FILE-NAME does not exist, it is created. If FILE-NAME already exists, it is overwritten. If a directory path is not specified for FILE-NAME, FILE-NAME is created in the current directory of the MaxL Shell. Directories cannot be created using the spool command.

Message logging begins with spool on and ends with spool off.

Syntax diagramFILE-NAME

Example

spool on to 'output.txt';

{MaxL statements}

spool off;

Sends output of MaxL statements to a file called output.txt, located in the current directory where the MaxL Shell was invoked, or in eas\console\bin if the MaxL Script Editor is being used.

spool on to 'c:\hyperion\output.txt';

Sends output of MaxL statements to a file called output.txt, located in the pre-existing directory specified by an absolute path.

spool on to '../../../output.txt';

Sends output of MaxL statements to a file called output.txt, located in the pre-existing directory specified by a relative path. The file would be located three directories above the current directory, or three directories above eas\console\bin if the MaxL Script Editor is being used.

Description

Most operating systems support three channels for input/output:

  • STDIN (standard input channel)

  • STDOUT (standard output channel)

  • STDERR (standard error channel)

Most operating systems also provide command-line options for re-directing data generated by applications, depending on which of the above channels the data is piped through.

Errors in MaxL are flagged as STDERR, allowing command-line redirection of errors using operating-system redirection handles. Non errors are flagged as STDOUT; thus normal output may be logged separately from error output. Here is an example of redirecting error-output at invocation time:

essmsh script.mxl 2>errorfile.err 

Note:

Operating-system redirection handles vary; check the platform documentation.

You can also redirect STDERR and STDOUT independently to different MaxL output logs, using the corresponding options in the spool command. For example, you can direct errors to one file and output to another by placing the following lines in your script:

spool stdout on to 'output.txt';
spool stderr on to 'errors.txt';

or you can direct errors only:

spool stderr on to 'errors.txt';

or you can direct output only:

spool stdout on to 'output.txt';

Note:

You cannot use the generic spool and the special output-channel spools in the same script. For example, the following is not valid:

spool on to 'session.txt';
spool stderr on to 'errors.txt';