CoreBOSBB
The cron debug thread: my cron task keeps running - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8)
+--- Thread: The cron debug thread: my cron task keeps running (/showthread.php?tid=1270)



The cron debug thread: my cron task keeps running - Guido1982 - 09-24-2018

I've got a recurring salesorder task and a planned report task that keep running. No idea why but that's not really my intention of this thread. I'd like to use this thread to teach a man how to fish. What are the best ways to debug any cron task that exceeds the time limit? Maybe I'm missing some Apache or PHP modules? I've come across this problem before and think it would be very useful for any coreBOS admin to have a good debug toolbox for cron tasks since they are hard to debug and I never really found a peak under the hood.


RE: The cron debug thread: my cron task keeps running - joebordes - 09-24-2018

This is what I do:

- open the command line and go to the coreBOS directory
- open config.inc.php or config-dev.inc.php and add: error_reporting(E_ALL);ini_set('display_errors',1);
- reset the scheduled task in Settings
- manually launch the cron in question: php vtigercron.php ScheduleReports

that usually shows the error on screen and gives you the first steps to start debugging

When you have to launch the cron repeatedly I usually reduce the time directly in vtiger_crontask table

When it gets REALLY complicated you can activate the BACKGROUND log in log4php as that log gives you cron/workflow detailed information


RE: The cron debug thread: my cron task keeps running - Guido1982 - 09-24-2018

Nice, got some error but I'll open another thread for that.

About the background log, I set my config.inc.php to log and set the log4php.logger.BACKGROUND to DEBUG,A8. I don't see a background.log file pop up when I do the testing. Am I missing something?

Ah, now I do have one. The javascript log was also set to A8, so it was written to the javascript.log file.