xfra35 / f3-cron

Job scheduling for the PHP Fat-Free Framework
GNU General Public License v3.0
72 stars 22 forks source link

Display function output #3

Closed clemorphy closed 8 years ago

clemorphy commented 8 years ago

Hi

Is there a way to display the output of the functions triggered by f3-cron ?

I use silent=false, but the only thing that it outputs is nameOfTheJob [async]

My function works well when called via HTTP, but it doesn't when called via CLI. I would like to have some error in the output, instead of just the name of the job.

I also use log=true but the cron.log file is not created in the TEMP folder.

Thanx

xfra35 commented 8 years ago

Hi,

silent=false is just there to display the list of due jobs and to know if they were executed synchronously or asynchronously. There's not way to get the output of an asynchronous job since it is run in the background.

What do you mean with "it doesn't when called via CLI"?

Here's the expected behaviour:

So if you read Job1 [async] and Job1 doesn't appear in cron.log, that means its execution failed for some reason.

To check if the job alone runs OK, just call it directly either with GET /cron/Job1 or php index.php /cron/Job1. This will execute it synchronously, no matter if it's due or not.

NB: cron.log belongs to LOGS (not TEMP). It was a mistake in the docs. I just fixed it.

clemorphy commented 8 years ago

Ok, I get it.

It makes sense that an async job can't output something directly.

I just needed to enable PHP logs for the CLI mode, now I can debug with my logs :)

And now I can see the cron.log file, which is not in the TEMP folder like you said, but in the LOGS folder.

Merci bien l'ami !

xfra35 commented 8 years ago

De rien. N'hésite pas si tu as d'autres questions.