Moodle
  1. Moodle
  2. MDL-36467

debugging warning when SCORM debugging turned on and large add_to_log data passed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.3.1, 2.3.2
    • Fix Version/s: 2.4
    • Component/s: SCORM
    • Labels:
    • Rank:
      45303

      Description

      mod\scorm\datamodel.php logs all tracking data to the log table if SCORM debugging is enabled which causes a database write error when the tracking data is really long (mdl_log.info = 255 chars whereas mdl_scorm_scoes_track.info = text). This is a problem because (in my experience) it is quite common for SCORM activities to put a whole lot of data in the suspend data element. Whilst the issue only occurs when debugging is enabled it would still be nice if it could be fixed. Maybe doing a substr before logging the data is sufficient?

        Activity

        Hide
        Dan Marsden added a comment -

        Hi Richard, thanks for the report - usually one bug per issue is best rather than 2 issues on one bug... but your first issue has been reported as MDL-36107 and a fix is in this weeks build which should be released later tonight so we can update the description on this issue to contain only your 2nd issue.

        Show
        Dan Marsden added a comment - Hi Richard, thanks for the report - usually one bug per issue is best rather than 2 issues on one bug... but your first issue has been reported as MDL-36107 and a fix is in this weeks build which should be released later tonight so we can update the description on this issue to contain only your 2nd issue.
        Hide
        Richard Ainger added a comment -

        Thanks for the tip Dan, I will keep that in mind next time I make a bug report!

        I also guess I didn't do a good enough search when logging the ticket so my apologies for that as well.

        Show
        Richard Ainger added a comment - Thanks for the tip Dan, I will keep that in mind next time I make a bug report! I also guess I didn't do a good enough search when logging the ticket so my apologies for that as well.
        Hide
        Dan Marsden added a comment -

        Hi Richard - I can't see how a db write error can occur with add_to_log when info is too long - the function add_to_log has handling that checks the length of the var and does a substr to make it fit before inserting it into the db. It does log an extra debugging message to warn the developer that the var has been shortened. Can you please provide more information on the db write error that you're seeing?

        Show
        Dan Marsden added a comment - Hi Richard - I can't see how a db write error can occur with add_to_log when info is too long - the function add_to_log has handling that checks the length of the var and does a substr to make it fit before inserting it into the db. It does log an extra debugging message to warn the developer that the var has been shortened. Can you please provide more information on the db write error that you're seeing?
        Hide
        Richard Ainger added a comment - - edited

        Sorry, I was recalling from issue from memory that I encountered a few months ago.

        After attempting to reproduce the error again I was only able to reproduce the debugging error you stated which I believe is in fact the error I was attempting to refer to.

        Would it still be possible to have the data trimmed before logging still so an alert box doesn't appear/exception info displayed in the SCORM API activity log when debugging is enabled? I remember it causing me some confusion back then working out why it was happening.

        Thanks for your time and my apologies for the confusion.

        Show
        Richard Ainger added a comment - - edited Sorry, I was recalling from issue from memory that I encountered a few months ago. After attempting to reproduce the error again I was only able to reproduce the debugging error you stated which I believe is in fact the error I was attempting to refer to. Would it still be possible to have the data trimmed before logging still so an alert box doesn't appear/exception info displayed in the SCORM API activity log when debugging is enabled? I remember it causing me some confusion back then working out why it was happening. Thanks for your time and my apologies for the confusion.
        Hide
        Dan Marsden added a comment -

        No worries.
        I'm not actually 100% sure that there's any point in the add_to_log call there - when scorm debugging is enabled it creates the pop-up window which lists a lot more information. This add_to_log call is only ever called when the full pop-up SCORM debugger is shown too - which to me makes it less useful as the full SCORM debugger has all the full debugging info and I'm not sure what the point is of adding a small subset of those entries to the log table. (I guess the call has been there since before we added the scorm debugger)

        My +1 to remove that add_to_log call completely but I'd like to get some feedback before I do this - I've added Matteo here as he does a bit of debugging - Matteo can you see any point in keeping that call to add_to_log or should we remove it?

        thanks,

        Show
        Dan Marsden added a comment - No worries. I'm not actually 100% sure that there's any point in the add_to_log call there - when scorm debugging is enabled it creates the pop-up window which lists a lot more information. This add_to_log call is only ever called when the full pop-up SCORM debugger is shown too - which to me makes it less useful as the full SCORM debugger has all the full debugging info and I'm not sure what the point is of adding a small subset of those entries to the log table. (I guess the call has been there since before we added the scorm debugger) My +1 to remove that add_to_log call completely but I'd like to get some feedback before I do this - I've added Matteo here as he does a bit of debugging - Matteo can you see any point in keeping that call to add_to_log or should we remove it? thanks,
        Hide
        Matteo Scaramuccia added a comment -

        Hi All,

        1. add_to_log running under scorm_debugging: just one, keeping care of both SCORM 1.3/2004 navigation requests - which are small anyway - and CMI data model which could be big for suspending data as well as for potentially everything being under CMIString4096 and CMIString256. As already pointed out by Dan it runs only when API Debug has been set.
          +1 to be removed because of both Dan's good reasoning and that data can be also observed using instruments like Fiddler on a running system when trying to debug students' issues in case the Moodle SCORM API debug will fail.
        2. add_to_log running under debugging: none, at least in 2.4. In 1.9 there is the same tracking for debugging purposes plus an issue about the length of the key colliding with the length of the field, already fixed; details in MDL-26880 with already my +1 for the deletion.

        TOTAL from me: +2

        Show
        Matteo Scaramuccia added a comment - Hi All, add_to_log running under scorm_debugging : just one, keeping care of both SCORM 1.3/2004 navigation requests - which are small anyway - and CMI data model which could be big for suspending data as well as for potentially everything being under CMIString4096 and CMIString256 . As already pointed out by Dan it runs only when API Debug has been set. +1 to be removed because of both Dan's good reasoning and that data can be also observed using instruments like Fiddler on a running system when trying to debug students' issues in case the Moodle SCORM API debug will fail. add_to_log running under debugging : none, at least in 2.4. In 1.9 there is the same tracking for debugging purposes plus an issue about the length of the key colliding with the length of the field, already fixed; details in MDL-26880 with already my +1 for the deletion. TOTAL from me: +2
        Hide
        Dan Marsden added a comment -

        NOTE TO INTEGRATOR: master only please

        Show
        Dan Marsden added a comment - NOTE TO INTEGRATOR: master only please
        Hide
        Dan Marsden added a comment -

        Thanks Matteo/Richard, I've pushed a commit up to remove that debug/add_to_log completely - I can't see any real use for it now that we have the SCORM debugger.

        Show
        Dan Marsden added a comment - Thanks Matteo/Richard, I've pushed a commit up to remove that debug/add_to_log completely - I can't see any real use for it now that we have the SCORM debugger.
        Hide
        Dan Poltawski added a comment -

        Thanks Dan. I've integrated this now (master only).

        Show
        Dan Poltawski added a comment - Thanks Dan. I've integrated this now (master only).
        Hide
        David Monllaó added a comment -

        It passes. Tested in master. I can see logs like:

        • scorm pre-view
        • scorm view
        • scorm launch

        But nothing like trk:scoid

        Show
        David Monllaó added a comment - It passes. Tested in master. I can see logs like: scorm pre-view scorm view scorm launch But nothing like trk:scoid
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Many, many thanks for your effort!

        Millions of people will enjoy the results of your work, yay!

        Closing as fixed. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Many, many thanks for your effort! Millions of people will enjoy the results of your work, yay! Closing as fixed. Ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: