11 Replies Latest reply on Dec 15, 2015 10:05 AM by siplus

    Logging Scripts, How detailed should it be ?

    macrolide

      Given my limited Filemaker Development experience, I would like to know from advanced users how detailed a Log should be?

       

      I have added a script step to log into a global field details for every script like

      • script name,
      • script start time,
      • account name,
      • globalFields Set/Reset,
      • globalVariables Set/Reset,
      • Records Generated,
      • Fields committed.

       

      What's the difference between using a .log file vs a .txt file?

      Should the Log file be tab delimited or comma delimited?

      Any pointers/suggestions to any resources on how to organise each log entry?

        • 1. Re: Logging Scripts, How detailed should it be ?
          Markus Schneider

          basically, log-files and txt-files are text files - ascii-text. Every texteditor will open them. On OSX, double-clicking a .log file will open it in the console application. A log-file shows what happened on a specific task (i.e. installer-log), time (system-log), 'situation' (crash-log), etc.

          -> check the FileMaker logs for details. They are created when importing records, importing scripts, etc.

           

          I personally don't write log's when running scripts - bt You might consider writing the priviledge set as well, number of records before and after the action, among others

          • 2. Re: Logging Scripts, How detailed should it be ?
            siplus

            Form follows function.

             

            Your log should contain the info you need in order to justify the very existence of the log. Nothing else, nothing more. And the impact on the normal flow of information inside the solution should not exceed 1%, imho.

             

            If you have such needs, using FM Pro Advanced is a must, with its debug and data viewer capabilities. That covers your analysis work.

             

            If the client wants a detailed protocol of who, when, what, where, how -  then it's a different matter.

             

            I usually add all the info I need (mainly timing data) to a $$Variable.

            I can view it in data viewer and also gather it into a global, should the need for storing arise.

            I usually separate fields with tab - char(9) .

            • 3. Re: Logging Scripts, How detailed should it be ?

              You can create a log file in a table and save worrying about an external log file although you could write the table to disk at any time, exporting the contents to a time stamped file, for isntance.

               

              This log table can be inside the working file or as an external file.

               

              Using FileMaker Gets simplifies the process quite a bit although you can use set field for various values.

               

              For instance a field Script Name with the calculation Get(scriptname) solves that problem.

               

              I've spent some time working on a login table and what you want to do is very easy to do with a table. Plus, each record can be time stamped etc.

               

              This is a lot easier than working with a text file on disk but if you need one, as I said, every so often you can export to an ascii file.

              • 4. Re: Logging Scripts, How detailed should it be ?
                Mike_Mitchell

                I agree with siplus: Put in as much information as you need.

                 

                I agree with jackrogers: I tend to write this to a table inside the database.

                 

                I would add that it's useful to enable a "debug" mode so that you can turn the logging function on and off. Run it only when it's needed to minimize the performance hit. Or, even better, have levels of logging (such as none, minimal, and full) that you can set using a field in a table.

                • 5. Re: Logging Scripts, How detailed should it be ?
                  macrolide

                  Despite being a vague question (can't figure out which one to be a correct answer), much appreciate all the replies.

                   

                  Had read something about Logging scripts in Filemaker Bible 10 or Filemaker developer techniques, both sadly became extinct a while ago. The need for logging scripts have disappeared since the advent of the script debugger !?

                  Guess the only time to include a logging feature is to create debugger like report when the database solution is being used by a person other than the developer himself.

                  • 6. Re: Logging Scripts, How detailed should it be ?
                    macrolide

                    Despite being a vague question (can't figure out which one to be a correct answer), much appreciate all the replies.

                     

                    Had read something about Logging scripts in Filemaker Bible 10 or Filemaker developer techniques, both sadly became extinct a while ago. The need for logging scripts have disappeared since the advent of the script debugger/ data viewer ?!

                    Guess the only time to include a logging feature is to create debugger like report when the database solution is being used by a person other than the developer himself.

                    • 7. Re: Logging Scripts, How detailed should it be ?
                      fm_toxy

                      I would create a developer library separately to log your scripts.

                      This saves you re-inventing the wheel for multiple databases.

                      This can also help when providing a handover document, should you leave your post for better things.

                       

                      Regards

                      • 8. Re: Logging Scripts, How detailed should it be ?
                        Mike_Mitchell

                        No, that's definitely not the case. It's frequently true that users run into odd behavior and you want to recreate what they were doing at the time. They won't be running the Script Debugger (may not even be running Advanced), and you'll want to know what they did.

                         

                        Because trust me: They won't remember the exact steps, and users don't think like developers.  

                        • 9. Re: Logging Scripts, How detailed should it be ?

                          Hi,

                           

                          I've used Ray Cologon's Script Logging scripts as described in his FM 10 Bible. He creates an off-screen window for a table that has 12 Fields.

                           

                          Each script that you wish it log starts with some steps to create a record with the details of user, timestamp, script name, etc and ends with a series of concluding steps where errors can be captured if written to a variable.

                           

                          The log for our main solution, which began in 2010, has 108 K records and is quite seamless in its operation except when using the Debugger.

                           

                          Let me know if you want more details.

                           

                          I hope that helps,

                           

                          John

                          Hamilton, NZ

                          • 10. Re: Logging Scripts, How detailed should it be ?
                            crm

                            I got into writing pretty long scripts. Between 200 and 750 Lines. For some Time not long ago I had about two weeks of FM14 crashes which were bad because it was impossible for me to find out the cause.

                            The trouble is, that FileMaker itself waits to write records to go on speeding along the Scriptlines. That is the deeper cause for my problem not finding the cause. Obviously the create record operations in subpscripts and apparently also in the main script are simply cashed - and here comes the big one : - They are NOT executed even when You put a store record comand there. Most records obvioulsy are NOT written when You order that with store record commands. FileMaker preferes to wait with that 'till the very end. Guess that can speed up things significantly - but is there no way to put back to normal for a test ?  A 'literal interpretation mode'?

                            That's the only reason I can see why I did'nt get the nescessary debugging information. Maybe it is some FileMaker-Apple-speedup module doing that. Even when the debugger ist switched on I found at least similar effects.

                             

                            Im hoping to find a way to write to an external File that is not delayed bei the FileMaker Script Interpreter or FM System - with a wait 'till done possibility. That's all I would need.

                            Would You have a useable AppleScript call handy I could build in my logging script ?

                            • 11. Re: Logging Scripts, How detailed should it be ?
                              siplus

                              "flush cache to disk" script step ?