Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging for cron events #19

Closed
johnbillion opened this issue Nov 23, 2017 · 2 comments
Labels
Milestone

Comments

@johnbillion
Copy link
Owner

@johnbillion johnbillion commented Nov 23, 2017

WP Crontrol should log all cron events for debugging purposes and expose the log somewhere.

This can be achieved by iterating distinct cron hooks in the cron array and adding an action which logs the event. Data to log includes:

  • Hook name
  • Timestamp
  • Parameters
  • Callbacks registered at the time the event ran
  • Whether it was run manually (via Run Now) or via the regular scheduling
  • Time taken to run (via an early action and a late action with timing)
  • Did the event miss its scheduled time? By how much?
  • Catch fatals? Probably needs PHP 7. Re-throw them.
  • PHP errors
  • Queries performed
  • HTTP API calls performed
  • Memory used

Plus:

  • Ability to call do_action( 'crontrol_something' ) to log extra data in the event log
  • Ability to throw an exception to cause an event to "fail", similar to Action Scheduler
  • Limit on the number of logs stored. Either a number or a time frame
  • Should be optional, ie. can be turned off
  • Ability to disable event logging by hook name, maybe a filter or maybe a UI control
  • Cron events by default logged in a post type, post meta, terms
  • Storage should be abstracted so it can be stored elsewhere, eg Stream, Simple History, custom table, system logger

Stretch Goals:

  • Extended support for Action Scheduler, list which jobs were triggered
@johnbillion

This comment has been minimized.

Copy link
Owner Author

@johnbillion johnbillion commented Aug 18, 2019

This is in progress in the develop branch. Lots still to do.

@johnbillion johnbillion added this to the 2.0.0 milestone Nov 5, 2019
@johnbillion

This comment has been minimized.

Copy link
Owner Author

@johnbillion johnbillion commented Nov 15, 2019

This is now available in 2.0.0-beta1. I might push the remaining features to 2.1, we'll see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.