In FileMaker 18, we received a new script step called Error Logging. When this script step is used, any errors that are generated from the running script are pulled into a log for review.

Parameters for the error logging script step in FileMaker 18

The step allows for two parameters. The first is whether to turn the logging on or off. Once error logging is turned on, any time a script in the current file generates an error, a file called ScriptsError.log will be created or appended to for as long as the file is open or if the script step is called again with the login set to off.

The error log captures the following:

The second parameter, Custom Debug Info, is optional. It’s set by clicking the gear icon in the script step. This will open up a calculation dialogue whose result will be appended to any entries created. This can be useful to capture other information not handled by the error log. I like to use a custom function called ErrorData which looks like so:

Here’s what the output looks like when opened using the console:

Output of the error logging script step in FileMaker 18

The ScriptErrors.log file lives in the user’s documents’ folder and is accessible via the new data file script steps by providing the filepath:

Get( DocumentsPath ) & “ScriptErrors.log”

Be advised that the file will be locked and inaccessible by the data file script steps until the Set Error Logging script step is turned off, so it’s a good idea to turn off error logging once you have executed the portions of a script you anticipate could generate errors.

Also note that the error logging state is specific to the file it was called in, so if you are calling a script that generates an error from another file with a parent script where you have error logging turned on, it will not create a new log entry. You have to turn error logging on a per file basis. FileMaker has a helpful tutorial video here that nicely covers the basics.

This tool gives us more options on how we can handle errors in an app, which means at the end of the day it’s a better overall experience for users and developers alike. I can’t wait to see how the community utilizes the new step. And, as always—Happy FileMaking folks!