log
Specifies a file where you want to log the outcome from the execution of the command, whether the command completes successfully or encounters errors. If you do not specify the {--log | -l} option, the command logs this error information to the console.
The logged results include:
Service output
Errors that occur while interpreting the command
Note: If the error occurs while the initializing the command, the error is written to the console rather than the file specified with the {--log | -l} option
Debug information if the
{--debug | -d} option is specified on the command
Syntax
--log | -l file
Arguments
Argument | Description |
file | Specifies the log file where you want the errors written. If the file you specify does not exist, the command creates it. You can specify: Absolute directory path and filename. Relative directory path and filename. The path is relative from where you initiated the command. Filename of a file in the same directory where you initiated the command. |
Usage Notes
If you use the
{--output | -o} option with the
{--log | -l} option and the command completes successfully, the command writes the results to the output file
and logs the outcome to the log file.
If you use the
{--error | -r} option with the
{--log | -l} option and the command encounters an error, the command writes the error results to the error file
and logs the outcome to the log file.
If a command uses the
{--debug | -d} command, the debug information is also written to the log file.
If the file you specify with the
{--log | -l} option already exists, the command appends the new service results to the file.
The error information includes a timestamp. Using this option for commands generates a history of the command execution and actions.
Examples
To log information to a file named “logfile.xml” in the directory c:\outputs:
--log c:\outputs\logfile.xml
To log information to a file named “logfile.json” in the \outputs directory relative to where you initiate the command:
--log outputs\logfile.json
To log information to a file named “logfile” in the same directory from where you initiate the command:
--log logfile