Permalink
Browse files

MDL-51109 task: more debug info for failed scheduled tasks

  • Loading branch information...
danpoltawski committed Aug 21, 2015
1 parent f660908 commit 56a1ac4d38159b22cc5c33cf1d15adac0debe3b9
Showing with 24 additions and 0 deletions.
  1. +8 −0 admin/tool/task/cli/schedule_task.php
  2. +16 −0 lib/cronlib.php
@@ -149,6 +149,14 @@
mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
mtrace("... used " . (microtime(true) - $pretime) . " seconds");
mtrace("Task failed: " . $e->getMessage());
if ($CFG->debugdeveloper) {
if (!empty($e->debuginfo)) {
mtrace("Debug info:");
mtrace($e->debuginfo);
}
mtrace("Backtrace:");
mtrace(format_backtrace($e->getTrace(), true));
}
\core\task\manager::scheduled_task_failed($task);
get_mailer('close');
exit(1);
View
@@ -91,6 +91,14 @@ function cron_run() {
mtrace("... used " . (microtime(1) - $pretime) . " seconds");
}
mtrace("Scheduled task failed: " . $task->get_name() . "," . $e->getMessage());
if ($CFG->debugdeveloper) {
if (!empty($e->debuginfo)) {
mtrace("Debug info:");
mtrace($e->debuginfo);
}
mtrace("Backtrace:");
mtrace(format_backtrace($e->getTrace(), true));
}
\core\task\manager::scheduled_task_failed($task);
}
get_mailer('close');
@@ -127,6 +135,14 @@ function cron_run() {
mtrace("... used " . (microtime(1) - $pretime) . " seconds");
}
mtrace("Adhoc task failed: " . get_class($task) . "," . $e->getMessage());
if ($CFG->debugdeveloper) {
if (!empty($e->debuginfo)) {
mtrace("Debug info:");
mtrace($e->debuginfo);
}
mtrace("Backtrace:");
mtrace(format_backtrace($e->getTrace(), true));
}
\core\task\manager::adhoc_task_failed($task);
}
get_mailer('close');

0 comments on commit 56a1ac4

Please sign in to comment.