MBS Xojo Conference
6/7th September 2018, Munich

« Filemaker: Export Tex… | Home | Ten days until Real S… »

Tracing MBS Filemaker Plugin


Sometimes you run a script and call 20 MBS plugin functions. But something goes wrong in-between and you'd like to know what function returns an error or gets a bad parameter. Maybe you have a typing error in the function name, a wrong parameter or some function returns an error?

In our plugin we have a special command called Trace. This command lets the plugin output messages for all calls to plugin functions to either a log file or the standard debug console. A file is useful for people developing or if you want your solution to write a log file for your user to send you.

For seeing live trace logs, we normally recommend to simply call MBS("Trace") with no parameters and run Console.app on Mac OS X and DebugView on Windows. The Debugview tool can be downloaded for free from Microsoft. In order to see messages from Filemaker Server, you need to run it as Administrator.

Like when using our Rename Container example database with tracing and you run the RenameIt script, you see output like this:
Nov 10 13:27:34 cs FileMaker Pro[8239]:MBS Plugin called with 3 parameters.
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 0: "Container.Rename"
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 1: Binary Data with 4 streams, 27304 Bytes in total: FNAM "filemac:/SnowLeopard/Users/cs/Desktop/logo.jpg", FORK "........", JPEG "......JFIF.....H.H......Photoshop 3.0.8BIM .......x.(...H.H.......R.......[ ..(.................4...2", SIZE 350 x 350
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 2: "test.jpg"
Nov 10 13:27:34 cs FileMaker Pro[8239]:ErrorCode 0 (no error), Result: Binary Data with 4 streams, 27228 Bytes in total: FNAM "file:test.jpg", FORK "........", JPEG "......JFIF.....H.H......Photoshop 3.0.8BIM .......x.(...H.H.......R.......[ ..(.................4...2", SIZE 350 x 350
Nov 10 13:27:34 cs FileMaker Pro[8239]:MBS Plugin called with 2 parameters.
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 0: "Container.getName"
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 1: Binary Data with 4 streams, 27304 Bytes in total: FNAM "filemac:/SnowLeopard/Users/cs/Desktop/logo.jpg", FORK "........", JPEG "......JFIF.....H.H......Photoshop 3.0.8BIM .......x.(...H.H.......R.......[ ..(.................4...2", SIZE 350 x 350
Nov 10 13:27:34 cs FileMaker Pro[8239]:ErrorCode 0 (no error), Result: "filemac:/SnowLeopard/Users/cs/Desktop/logo.jpg"
Nov 10 13:27:34 cs FileMaker Pro[8239]:MBS Plugin called with 2 parameters.
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 0: "Container.getName"
Nov 10 13:27:34 cs FileMaker Pro[8239]:Parameter 1: Binary Data with 4 streams, 27228 Bytes in total: FNAM "file:test.jpg", FORK "........", JPEG "......JFIF.....H.H......Photoshop 3.0.8BIM .......x.(...H.H.......R.......[ ..(.................4...2", SIZE 350 x 350
Nov 10 13:27:34 cs FileMaker Pro[8239]:ErrorCode 0 (no error), Result: "file:test.jpg"

The first thing you see is that we have three MBS plugin calls there, but the script has only one call. Weird? Actually no as the database defines two field with calculations, so the plugin is called there, too. Now the plugin informs you about the calls and the number of parameters. It writes those parameters to the log. For text you see the text in quotes. For container values, you see Binary Data being listed with very detailed content details. Like the first one has 4 streams and contains a file name, a fork with data, a JPEG data stream and the SIZE information. In the streams all the unprintable characters are printed as dots.

After the function was executed, the plugin shows the error code and the result. For the error codes we know a few and can show the error type. For the result as for parameters the content is shown so you see exactly what is returned.

So we hope this command helps you. Especially with looking for bugs in scheduled scripts on a Filemaker Server.
10 11 12 - 14:26
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.