Problem/Motivation

When cron logging is enable, each time cron is executed, simple_cron create a warn log "Cron job @job should not be running." for each job that is not executed at this time.

This is not an error even not an info, it's perfectly normal that a job is not executed outside its scheduled time.

It pollutes the logs, specially if cron is run frequently and with a lot of jobs.

Steps to reproduce

  • Enable cron logging
  • Be sure that at least several cron jobs are scheduled
  • Wait to a cron execution
  • Parse log, there should be a warning per task that is not executed that says "Cron job @job should not be running."

Proposed resolution

Remove the warning in web/modules/contrib/simple_cron/src/Entity/CronJob.php:312:

      if (!$plugin ) {
        $this->logger->warning('Cron job @job could not be run: missing plugin.', ['@job' => $this->label()]);
        return FALSE;
      }
      if (!$this->shouldRun($request_time, $force)) {
        return FALSE;
      }
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

O'Briat created an issue. See original summary.

o'briat’s picture

Issue summary: View changes

o'briat’s picture

Status: Needs work » Needs review
ktpm’s picture

Hi, we are using simple cron with the watchdog mailer module because we want to be notified if a cron fails for any reason.
The mailer module sends logs from warning level and anything more severe though.
By removing the warning log this change does work for us. Thanks.

o'briat’s picture

Status: Needs review » Reviewed & tested by the community

I mark this issue as RTBTC as it run smoothly on production websites for 4 months

ghaddon’s picture

Patch from MR above should anyone else need it.

scott_euser made their first commit to this issue’s fork.

scott_euser’s picture

Yep I agree with this - thanks for fixing it! Will just let the pipeline run and see if any corresponding test updates are needed

  • scott_euser committed c5a80d41 on 1.1.x authored by o'briat
    Issue #3383149 by o'briat, scott_euser: Simple cron log should not log...
scott_euser’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.