Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Trace

Starts logging all plugin calls to a text file.

Component Version macOS Windows Linux Server iOS SDK
Trace 2.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Trace" { ; path; Append } )   More

Parameters

Parameter Description Example Flags
path The native file path to the log file. "/Users/name/Desktop/trace.txt" Optional
Append Whether to append or create new file.
Pass 1 to append or 0 (default) for new file.
1 Optional

Result

Returns "OK" on success.

Description

Starts logging all plugin calls to a text file.
If you pass a path, debug messages are written to the file. Else the plugin writes to debug console. See Console.app on Mac or DebugView on Windows.
See also Trace.Off and Trace.SetErrorsOnly.

On Linux, if no path is provided, the log output will go to stderr, which is usually redirected by our plugin to /FileMakerData/Logs/ or /opt/FileMaker/FileMaker Server/Logs/ folder. The log files are StdErrWeb.log and StdOutWeb.log for Web Direct and StdErrServerScripting.log and StdOutServerScripting.log for normal scripting (the names may change in different plugin versions).

On Windows with a FileMaker Server, you can see debug messages in DebugView if you run DebugView application as admin and enable global Win32 listening.
For FileMaker Server on macOS you can see messages in /Library/FileMaker Server/Logs/stderr file.

On Windows the log file is UTF-16 with BOM and CRLF as line endings. On macOS, Linux and iOS, you get an UTF-8 file with BOM and LF line endings.

See Trace.GetErrorsOnly, Trace.GetWithTimes, Trace.SetErrorsOnly and Trace.SetWithTimes to set options.

Added tracing of SQL commands for our SQL functions for v13.1. The SQL may be truncated around 4000 characters to limit how much text we log.

Log files paths for MBS Plugin on Linux:
/opt/FileMaker/FileMaker Server/Logs/StdErrServerScripting.logError log for Server Scripting
/opt/FileMaker/FileMaker Server/Logs/StdOutServerScripting.logOutput log for Server Scripting
/opt/FileMaker/FileMaker Server/Logs/StdErrDataAPI.logError log for Data API
/opt/FileMaker/FileMaker Server/Logs/StdOutDataAPI.logOutput log for Data API
/opt/FileMaker/FileMaker Server/Logs/StdErrWeb.logError log for Web Direct
/opt/FileMaker/FileMaker Server/Logs/StdOutWeb.logOutput log for Web Direct

Other OS have similar paths. You may find .old files with previous log files, so you can review the old log after a crash.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Log plugin calls to console:

MBS( "Trace" )

Log plugin calls to desktop on Windows:

MBS( "Trace"; MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ); "trace.txt" ))

Log plugin calls to temp folder on Mac or Linux:

MBS( "Trace"; "/tmp/MBS Plugin Log.txt")

Log to log file on desktop:

Set Variable [$TracePath; Value:MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ); "trace.txt" )]
Set Variable [$r; Value:MBS("Trace"; $TracePath)]

Setup logging on server with multiple log files and times:

Set Variable [ $r; Value: MBS( "Trace.SetWithTimes"; 1) ]
Set Variable [ $r; Value: MBS( "Trace.SetServerLogPath"; "/Library/FileMaker Server/Logs/") ]
Set Variable [ $r; Value: MBS( "Trace") ]

See also

Release notes

  • Version 14.3
  • Version 14.1
    • Changed Trace function to not shorten texts with CURL.DebugMessages or returned error.
  • Version 13.1
    • Fixed a crash in trace function.

Blog Entries

This function is free to use.

Created 18th August 2014, last changed 1st April 2024


TouchBar.Visible - Trace.AreErrorNotificationsEnabled