Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-55141

Add debugging for running tasks

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.2
    • Component/s: Tasks
    • Testing Instructions:
      Hide

      Run a task with specific options for SQL debugging and/or Moodle debugging.

      Example: php admin/tool/task/cli/schedule_task.php --execute=\\mod_forum\\task
      cron_task --showsql --showdebugging

      Show
      Run a task with specific options for SQL debugging and/or Moodle debugging. Example: php admin/tool/task/cli/schedule_task.php --execute=\\mod_forum\\task cron_task --showsql --showdebugging
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:

      Description

      We sometimes get script errors for running certain tasks, such as \mod_forum\task\cron_task

      A single task can be run as

      php admin/tool/task/cli/schedule_task.php --execute=\\mod_forum\\task\\cron_task
      

      What we want to do is add an option to do database debugging. When you run the Moodle cron, you can set the following configs to enable debugging:

      $CFG->showcronsql = 1;
      $CFG->showcrondebugging = 1;
      

      That in turns sets debugging as:

          if (!empty($CFG->showcronsql)) {
              $DB->set_debug(true);
          }
          if (!empty($CFG->showcrondebugging)) {
              set_debugging(DEBUG_DEVELOPER, true);
          }
      

      We want to be able to enable similar debugging via the command line for schedule tasks as:

      php admin/tool/task/cli/schedule_task.php --execute=\\mod_forum\\task\\cron_task --showsql --showdebugging
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              anantm23 Anant Mahajan
              Reporter:
              rex Rex Lorenzo
              Peer reviewer:
              Mark Nelson
              Integrator:
              David Monllaó
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                5/Dec/16