Set Error Logging

Controls whether errors are logged while the current file's scripts are running.

Options 

  • On starts logging script errors. Errors continue to be logged for all scripts in the current file until the file is closed or this script step is run with the Off option.

  • Off stops logging script errors.

  • Custom debug info is an expression evaluated when a script error is logged. Use this option to provide additional information that will help you debug a problem.

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect Yes
FileMaker Server Yes
FileMaker Cloud No
FileMaker Data API Yes
Custom Web Publishing No

Originated in version 

18.0

Description 

After this script step is performed, the log file is created when the first script error is caused by any script in the current file. An entry is added to the log file whenever a script step returns a nonzero error code. If the log file already exists, entries are appended to the file.

Each line in the log file presents information in the following order separated by Tab characters:

Log entry information

Notes

Timestamp

The client's date and time when the error occurred.

Database session number

ID of the session the script is running in.

Filename

The name of the file the script is in.

Account name

The account that ran the script.

Script name [script index]

The index is the script's position (starting with 1) in the scripts pane in the Script Workspace.

Step name [line number]

 

Error code

See FileMaker error codes.

Custom debug info

 

Notes 

  • To perform this script step, the user or the script must have full access privileges. See Creating and editing scripts.

  • For FileMaker Pro and FileMaker Go, the log file is named ScriptErrors.log and is created in the user's Documents folder.

  • For scripts run via the FileMaker Script Engine, the Web Publishing Engine (for FileMaker WebDirect), and the FileMaker Data API on FileMaker Server, script error logging is controlled in two places:

    • By this script step in a script

    • By the server administrator turning on script logging on the server

    Both must be turned on for a script to log errors.

    For the names and locations of script error log files and how to turn on script logging in FileMaker Server Admin Console, see FileMaker Server Help.

Example 1 

Turns on script error logging and adds the current values of a variable and a field to help debug a problem.

Copy
Set Error Logging [ On ; Custom debug info: "Index: " & $Counter & ", PrimaryKey: " & Table::PrimaryKey ]

When the first error occurs, the ScriptErrors.log file contains:

Copy
2024-01-22 09:43:04.552 -0800   @1   Inventory.fmp12   Admin   Process records [42]   Read from Data File [7]   100   Index: 7, PrimaryKey: 20E190F3-67A8-4DCF-94CF-A5EA72971FFC