joebd's picture

In D6 I came up with a way to get watchdog to log the time for each individual cron job per module.  Sometimes this info is really helpful if you're seeing issues with your cron.  I've lost access to that code.  As I recall this was a code addition to the main cron module which is the gatekeeper for all the modules cron tasks I think.

I'm getting numerous messages "Attempting to re-run cron while it is already running."  So it appears some cron task is taking too long.  Which one?  Output from the above should help.  

Seems like this might be a good option for cron: "More verbosity in the cron logs?"  Cron does lots of things.  Usually smoothly in the background.

Thanx All.  Backdrop on!

Accepted answer

@flightrs, thanx for those ideas.

Think I dug it up out of my memory.  I put this (JG line) into the cron code in core/includes/common.inc around line 6291.  It's a simple way to get an idea of which cron task runs when.  Try it out.  Might be informative.  It could be modified to give the time to your desired granularity.

      try {
       watchdog('cron',"JG: calling $module cron handlers",NULL,WATCHDOG_INFO,NULL); // JG
       module_invoke($module, 'cron'); 
     } 

I think my problem is elsewhere, but this might be helpful to others wading through cron quagmires!

Comments

 

Hi,

D6 represent! I really have not tried this, but you could try the Rules module, which has some related stuff to that. The tool would appear in Configuration -> Workflow -> Rules

Create a new Rule and add to "Event" (see focused item):

 

 

Then add a new Action below, with:

 

And i assume you could set whatever value in these boxes:

Again, i have not tried this and don't know about working with Watchdog, but i hope it works!

Edit: 

I thought the "Values" fields could be populated with whatever values or custom code - but it looks like they're constrained to specific patterns, sorry. I found something in Components though:

Whatever can be done with that. Then maybe it's an advanced code question beyond my scope of knowledge... I have not seen any module-related entries yet. :)

@flightrs, thanx for those ideas.

Think I dug it up out of my memory.  I put this (JG line) into the cron code in core/includes/common.inc around line 6291.  It's a simple way to get an idea of which cron task runs when.  Try it out.  Might be informative.  It could be modified to give the time to your desired granularity.

      try {
       watchdog('cron',"JG: calling $module cron handlers",NULL,WATCHDOG_INFO,NULL); // JG
       module_invoke($module, 'cron'); 
     } 

I think my problem is elsewhere, but this might be helpful to others wading through cron quagmires!