Domanda

Quite often when I'm attempting to create a CRON job I'll mess up along the way and the job will fail to run.

Typically I'd check my logs and see where I went wrong, put the missing semicolon back, and continue on my way, but when it comes to cron jobs Magento rarely gives you any information of substance.

The messages field is null in the cron_jobs table, no messages are left in the Php error logs, none in the magento exceptions, none in cron.log, and none anywhere else I can think of to check, but the job still gets an "error" status.

Am I just not looking in the correct place for these errors or is there some way to make the cron log them somewhere?

È stato utile?

Soluzione

In my case, setting

ini_set('display_errors', 1);

Helped immensely. I was under the impression that error_reporting(E_ALL); would show errors and for the most part it did but under some circumstances, but setting the above line in app/bootstrap.php shows a lot more errors that I was not aware of due to no visible loss of functionality.

Altri suggerimenti

(For those who came here from google as me, also for myself in the future.)

Just add some params to forward cron output to specific files, eg.

php -d display_errors=1 bin/magento cron:run >> /path/to/cron.log 2>> /path/to/cron.error.log

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top