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

Show debugging calls in tasks logs regardless of debugdisplay

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_404_STABLE
    • MDL-80554-cron-debugdisplay
    • Hide

      1) Install this plugin

      https://github.com/catalyst/moodle-tool_testtasks

      You can use the below git command

      git clone git@github.com:catalyst/moodle-tool_testtasks.git admin/tool/testtasks

      Login as admin and navigate to Site Administration to finish the upgrade.

      2) Set this in config.php

      $CFG->debug = 0;
      $CFG->debugdisplay = 0;

      3) Run this task:

      php admin/cli/scheduled_task.php --execute='\tool_testtasks\task\mtrace_task'

      4) Confirm that you see output lines with numbers 1, 2, 9, 10 & 11

      5) Set $CFG->debug = 1; and repeat the task run

      6) Confirm you see an additional lines for '++ 7 debugging none ++'

      7) Edit admin/tool/testtasks/classes/task/mtrace_task.php and uncomment the exception at the end so the task fails

      8) Run the task again twice so it fails and the ramps up the faildelay and the debugging level

      9) Confirm you now also see debugging lines with 3, 4, 5, 6 & 7 in them

       

      Show
      1) Install this plugin https://github.com/catalyst/moodle-tool_testtasks You can use the below git command git clone git @github .com:catalyst/moodle-tool_testtasks.git admin/tool/testtasks Login as admin and navigate to Site Administration to finish the upgrade. 2) Set this in config.php $CFG->debug = 0; $CFG->debugdisplay = 0; 3) Run this task: php admin/cli/scheduled_task.php --execute='\tool_testtasks\task\mtrace_task' 4) Confirm that you see output lines with numbers 1, 2, 9, 10 & 11 5) Set $CFG->debug = 1; and repeat the task run 6) Confirm you see an additional lines for ' ++ 7 debugging none ++ ' 7) Edit admin/tool/testtasks/classes/task/mtrace_task.php and uncomment the exception at the end so the task fails 8) Run the task again twice so it fails and the ramps up the faildelay and the debugging level 9) Confirm you now also see debugging lines with 3, 4, 5, 6 & 7 in them  

      It's gray is this is a bug or feature, but I would argue that debugdisplay is a setting which only has meaning in the context of a web page and should have no bearing on if debugging is shown in the task logs. debugdisplay is only typically on in a development environment and you never want the issues shown to a student but cron logs are never exposed to end users.

      To reproduce install this:

      https://github.com/catalyst/moodle-tool_testtasks

      then compare the results of this with debugdisplay on and off:

      php admin/cli/scheduled_task.php --execute='\tool_testtasks\task\mtrace_task'

      In particular if a task has failed then the debugging is ramped up to developer, but none of those logs are shown because debugdisplay is off.

      The solution could be:

      a) make debugging ignore debugdisplay if it is a CLI script

      b) make the cron processor turn on debugdisplay when it runs a script and especially when it has ramped up debugging if it has failed

      I think a) is more correct but I'll do b) as its probably safer and much smaller in scope.

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Benjamin Walker Benjamin Walker
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.