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

Add debugging for running tasks

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Fixed
    • Minor
    • 3.2
    • 3.1
    • Tasks
    • MOODLE_31_STABLE
    • MOODLE_32_STABLE
    • 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

    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

              anantm23 Anant Mahajan
              rex Rex Lorenzo
              Mark Nelson Mark Nelson
              David Monllaó David Monllaó
              Frédéric Massart Frédéric Massart
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5/Dec/16