CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How do I tweak the settings for the 'cleanup' scheduled job?
Pages: [1]

Author Topic: How do I tweak the settings for the 'cleanup' scheduled job?  (Read 575 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
How do I tweak the settings for the 'cleanup' scheduled job?
July 08, 2013, 11:52:00 am
Can someone please point me in the direction to the file that controls the removal of old files in ConfigAndLog through the 'cleanup' scheduled job?

My goal is for the scheduled job to delete *.log files more or less frequently than currently configured.  I can't find these settings.

Try CiviTeacher: the online video tutorial CiviCRM learning library.

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: How do I tweak the settings for the 'cleanup' scheduled job?
July 10, 2013, 07:54:09 am
As far as I can tell the cleanup job doesn't touch the *.log  files. It looks like the logs are checked for rotation every time they are accessed.

From Error.php there is the createDebugLogger function which is called every time CRM_Core_Error::debug_log_message is called.
Code: [Select]
  /**
   * Obtain a reference to the error log
   *
   * @return Log
   */
  static function createDebugLogger($comp = '') {
    $config = CRM_Core_Config::singleton();

    if ($comp) {
      $comp = $comp . '.';
    }

    $fileName = "{$config->configAndLogDir}CiviCRM." . $comp . md5($config->dsn) . '.log';

    // Roll log file monthly or if greater than 256M
    // note that PHP file functions have a limit of 2G and hence
    // the alternative was introduce
    if (file_exists($fileName)) {
      $fileTime = date("Ym", filemtime($fileName));
      $fileSize = filesize($fileName);
      if (($fileTime < date('Ym')) ||
        ($fileSize > 256 * 1024 * 1024) ||
        ($fileSize < 0)
      ) {
        rename($fileName,
          $fileName . '.' . date('Ymdhs', mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")))
        );
      }
    }

    return Log::singleton('file', $fileName);
  }

and the comments there says:
Code: [Select]
// Roll log file monthly or if greater than 256M
// note that PHP file functions have a limit of 2G and hence
// the alternative was introduce
« Last Edit: July 10, 2013, 08:22:05 am by lolas »
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: How do I tweak the settings for the 'cleanup' scheduled job?
July 10, 2013, 10:25:17 am
Thanks, so are old log files (older than a month) simply deleted?
Try CiviTeacher: the online video tutorial CiviCRM learning library.

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: How do I tweak the settings for the 'cleanup' scheduled job?
July 10, 2013, 11:57:51 am
It looks like they are not according to this post: http://forum.civicrm.org/index.php?topic=18889.0.
I don't see any more recent discussion than that. Actually that was one of your threads as well where in that case the logs were getting large and needed to be deleted with a shell script.

I also looked on some of our long running sites and there are some pretty old logs hanging around.
I think that it is better to have them there with the large disc space plans most hosting sites offer.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How do I tweak the settings for the 'cleanup' scheduled job?

This forum was archived on 2017-11-26.