peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
811 stars 144 forks source link

Storing exception on failed job #84

Closed jfilla closed 5 years ago

jfilla commented 5 years ago

Hi,

thanks for this library. It would be nice to store exception on failed jobs for debugging. Now you can only access exception message via outputSchedule, which is not enough to debug complex jobs.

Should I send PR?

peppeocchi commented 5 years ago

@jfilla yes that would be great, if you're planning on doing that I would make this optional via config

jfilla commented 5 years ago

@peppeocchi PR

peppeocchi commented 5 years ago

@jfilla thanks for the PR, I just merged it. Would you mind adding something to the documentation? As soon as the documentation is updated I'll push out a new release.

Thanks again!

jfilla commented 5 years ago

@peppeocchi docs

Btw, have you considered cathing php error or warnigs?

peppeocchi commented 5 years ago

@jfilla not really, the main purpose of the scheduler, when it was initially built, was to provide an easy way of scheduling jobs without having to update the crontab every time. That being said, the jobs were all meant to run in background, so error catching/handling should really be handled at the job level instead of the scheduler.

What I am trying to say is that if you have a bug in the job's code, the scheduler is not really the place to debug it. Exceptions are different, that's why I agreed to your suggestion, but php error/warnings to me feel more of buggy code (typos etc...) than anything else.