# Error logging

This topic describes how to record compiling errors when
using FlashBASIC. Errors encountered during runtime are logged to
the DM,RUNTIME-ERRORS file. These errors can
be displayed by using the TCL command LIST-RUNTIME-ERRORS

When compiling FlashBASIC programs with the o option, the compiler automatically logs all compilation errors if
a data section called $log is present in the user's
BASIC program file. The log is updated *only* when errors occur.
Each log entry's ID is the same as the ID of the item being compiled.

The first attribute of the entry consists of the time and date
that the error occurred as well as the phase of compilation where
the error occurred. Other attributes can contain additional undefined
information can contain UNIX error messages.

- Errors logged as phase 0 errors are problems detected by the standard FlashBASIC compiler.

- Errors logged as phase 1 and higher are FlashBASIC compilation errors.

- Errors occurring higher can indicate an installation problem or the lack of a resource, such as swap space. In these cases, attributes 2 and higher provide more exact error reporting.

**For UNIX:** Not supported

**For Windows:** FlashBASIC runtime errors can be logged to the Windows event log. This
 feature is set from the FlashBASIC tab of the D3 Device Manager. See the D3 System
 Administration Guide for more information.

A
Windows event log entry has the following format:

Runtime error ** @ **:**

where:

| | FlashBASIC error message item-ID. |
| --- | --- |
| | Item-ID of the FlashBASIC module. |
| | Source line number. |
Additional information can also be logged in the Data section
of the Windows event log (accessible through the Event Detail dialog
box in the Windows event viewer). For example:

```
Runtime error B12 @ myprog :15
```
B12 is a file has not been opened error, occurring in
module myprog at line 15.

## Example(s)

To enable logging for a file
called bp, type:

```
create-file bp,$log 7
```
Compiling using the o option now logs
errors into the bp,$log file. These can be displayed
by typing any of these commands:

```
ct bp,$log
list-item bp,$log
sort-item bp,$log
```

---
Source: https://d3codex.com/pickbasic-flashbasic/error-logging/ - part of the D3Codex reference.
