Cron task output don't show BBDD query

Cron task output don't show BBDD query

by Kilian Gandos -
Number of replies: 3
Hi everyone.

I have a 3.9 moodle in production.

I have a problem with one of the scheduled cron task (Answer sheet evaluation for the offlinequiz-plugin) that fails and gives an error writing to database.

I tried to figure whats exactly the problem and i see that in config-dist.php you can activate this to output the error and the query that the cron executes:

// Add SQL queries to the output of cron, just before their execution

 $CFG->showcronsql = true;

// Force developer level debug and add debug info to the output of cron

 $CFG->showcrondebugging = true;

After doing that i tried to execute the task and after that i cannot see diference between before and after activate the output and debug for the cron. 

If I go to the site administraton, server, task, task logs and try to open the failed arttempt of the cron i can see the same as before (no query sentence and no query error only the text error writing on database):

Execute scheduled task: Answer sheet evaluation for the offlinequiz-plugin (mod_offlinequiz\task\page_evaluation_task)

... started 12:01:02. Current memory use 6.3MB.
... used 12 dbqueries
... used 0.0063009262084961 seconds
Scheduled task failed: Answer sheet evaluation for the offlinequiz-plugin (mod_offlinequiz\task\page_evaluation_task),error writing to database
Where can i see the query output that the cron try to execute and the error? now i have  $CFG->showcronsql = true and  $CFG->showcrondebugging = true
in production (it seems no difference for the users).
While i'm writing this i'm downloading the project and the BBDD to try to debug the site in local, but if anyone ca tell me where can i see the sql output of the cron
will help me a lot because if i can see the query problem probably i can solve the error.
Regards.



Average of ratings: -
In reply to Kilian Gandos

Re: Cron task output don't show BBDD query

by Ken Task -
Picture of Particularly helpful Moodlers
In Section 7 of config-dist.php there are more than one line to add to config.php to turn on debugging.   Plus one can limit debugging to a user ID number (yours), me thinks.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Cron task output don't show BBDD query

by Kilian Gandos -
Thanks a lot Ken. I will try to activate an see how it works,

In this time i tried to delete the activities of offlinequiz in the recicle byn of the courses, there was a quite fiew of them. After that the cron runs ok and the offlinequiz results after upload the files are running again.
Average of ratings: Useful (1)
In reply to Kilian Gandos

Re: Cron task output don't show BBDD query

by Ken Task -
Picture of Particularly helpful Moodlers
Ahhhh, yes ... the 'recylebin snafu'! sad
Suggest setting recyclebin to display all the time in course admin menu.  Default is to display only when there is something in recyclebin - easy to miss the addition to the course admin menu.

In addition consider shortening the time recyclebin backups are retained - especially if one is facing a space crunch.

If it's just you as admin and teacher in courses you are aware ... if you support other teachers using system they might need a reminder that when they delete a module from their course and then decide that was a mistake, they don't have a lot of time to restore the module before that backup is moved to trashdir where it can't be recovered from the Moodle admin UI.

At any rate, glad you found and fixed your issue. smile
'SoS', Ken