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

Cron: In log, scheduled tasks don't show component

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Run cron, e.g. in web browser (if there aren't any tasks that are due, wait for some to be due or change scheduled task settings).
      2. Look at the logs around scheduled tasks.

      EXPECTED:
      Scheduled tasks should show the classname as well as the human-readable name. Other log is not changed. Example:

      Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
      ...
      Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

      3. Manually run a scheduled task (assuming you are set up to run tasks with CLI, i.e. on local machine, I can't get it to work on mine):

      php admin/tool/task/cli/schedule_task.php --execute=

      After the execute= enter a task name with double backslash between each component, for example mod_forum (double backslash) task (double backslash) cron_task. (Note: Jira won't display this correctly for me.)

      EXPECTED: With regard to the lines being changed as part of this issue (as shown above) it should show the same text around task execution as the web-based cron run, with class name in brackets.

      Show
      1. Run cron, e.g. in web browser (if there aren't any tasks that are due, wait for some to be due or change scheduled task settings). 2. Look at the logs around scheduled tasks. EXPECTED: Scheduled tasks should show the classname as well as the human-readable name. Other log is not changed. Example: Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task) ... Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task) 3. Manually run a scheduled task (assuming you are set up to run tasks with CLI, i.e. on local machine, I can't get it to work on mine): php admin/tool/task/cli/schedule_task.php --execute= After the execute= enter a task name with double backslash between each component, for example mod_forum (double backslash) task (double backslash) cron_task. (Note: Jira won't display this correctly for me.) EXPECTED: With regard to the lines being changed as part of this issue (as shown above) it should show the same text around task execution as the web-based cron run, with class name in brackets.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-51330-master

      Description

      In cron logs, it shows 'Executing scheduled task' logging for each task.

      This shows the display name of the task, but does not include the plugin name that owns that task. I propose adding the class name (which includes the component) in brackets after the task name. This is more consistent with adhoc tasks, which don't show a name and only display the class name, and provides all the necessary information for administrators about which plugin is causing a potential problem.

      Without this change, it would be possible for task authors to include the name of their plugin within the name of the task. However, doing this makes the table that lists scheduled tasks (admin settings) look bad because that table already includes the component name as a separate column.

      Dan pointed out that changes in this area might need to be done in more than one location, as in this recent commit:

      https://github.com/moodle/moodle/commit/a6e9c23016d115541f3d089cb6885441e287ada8

      Based on this I have also changed some of the wording of the CLI task runner so that it is consistent with the 'normal' cron, and made the same change there to show the class.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15