### 2.3.77. JOURNAL

Controls the logging of commands and output.

#### Syntax

`JOURNAL` [/A] [{OFF | ON="`filename`"}]

where:

`/A`

Appends information to an existing file.

`OFF`

Closes the journal file and stops collecting information. This is the default setting.

`ON`

Starts writing information to the journal file.

`filename`

Specifies the journal filename. If you do not specify a filename extension, the extension `.jou` is used. Quotation marks are optional, but see Rules for specifying filenames in the JOURNAL command for details on how to specify filenames that include a path.

#### Description

The JOURNAL command starts or stops saving, in a specified file:

• the commands that you enter

• any output that is generated by a command

• error messages

• text specifically sent to the journal file.

If you are using the GUI, then the log file contains the same information that is displayed in the Cmd tab of the Output view.

### Note

If the specified file exists and you do not specify the `/A` parameter, the existing contents of the file are overwritten and lost.

The JOURNAL command runs asynchronously unless it is in a macro.

#### Rules for specifying filenames in the JOURNAL command

Follow these rules when specifying a filename:

• If the filename consists of only alphanumeric characters, slashes, or a period, but the filename does not start with a slash, then you do not have to use quotation marks. For example, `includes/file`.

• Filenames with a leading slash must be in double quotation marks, for example `"/file"`.

• Filenames containing a backslash must be in single quotation marks. For example `'\file'` or `'c:\myfiles\file'`.

Alternatively, you can escape each backslash and use double quotation marks. For example, `"c:\\myfiles\\file"`.

• You can use environment variables to specify paths to a file. For example, if `PATHROOT=C:\MYFILES` and `PATHTEST=TEST1`:

```'\$PATHROOT\\$PATHTEST\test1.c'
```

You can include:

• the filename as part of the second environment variable, and then specify `'\$PATHROOT\\$PATHTEST'`.

• the path separator in the environment variable, and then specify `'\$PATHROOT\$PATHTEST'`.

#### Example

The following examples show how to use JOURNAL:

`JOURNAL ON='c:\temp\log.txt'`

Start logging output to the file `c:\temp\log.txt`, overwriting any existing file of that name.

`JOURNAL /A ON="log"`

Start logging output to the file `log.jou` in the current directory of the debugger, appending the new log text to the file if it already exists.

`JOURNAL OFF`

Stop logging output.