2

Hi If magento fails to run the log cleaning process as per the configuration then where it does saves the error_log (or) failure status? Magento doesn't clean the log tables periodically.

Note: I can't set Cron from cpanel(WHM) to do this automatically, as I don't have option.

Any help will be appreciated

4
  • If you cannot set up a cron job to run Magento's cron trigger (either cron.sh or cron.php) regularly, then Magento's internal cron jobs don't run. If your hosting provider won't let you run cron jobs, then you will have to call cron.php periodically by calling it remotely with curl or wget. Feb 20, 2015 at 8:11
  • I have run example.com/cron.php however this never cleared the log tables ?
    – Dev
    Feb 20, 2015 at 11:18
  • After a long time ../cron.php executed with folowing error email exception 'Mage_Core_Exception' with message 'Too late for the schedule.'
    – Dev
    Feb 20, 2015 at 13:47
  • See answer below, cron.php trigger has to happen often enough to run job within its set execution time. Feb 20, 2015 at 16:41

2 Answers 2

2

If you cannot set up a cron job to run Magento's cron trigger (either cron.sh or cron.php) regularly, then Magento's internal cron jobs don't run.

If your hosting provider won't let you run cron jobs, then you will have to call cron.php periodically by calling it remotely with curl or wget.

Two things to finish out the setup:

  1. you must run cron.php at least every 15 minutes minimum so you don't get "too late for the schedule" because the job got set but didn't run within the expiry time period. Magento cron jobs are a two step process, the job gets set on the first trigger (scheduled), then then on next trigger, it gets run (at about the scheduled time after the nearest trigger runtime)

  2. you must go to System->Config->Advanced->System to complete the Log Cleaning setup.

enter image description here

Generate schedule information (System->Config->Advanced->System) under the Cron windowshade for a system that's running cron.sh/cron.php every 15 minutes.

Note: AOE_Scheduler is being run on this system and the extra fields are there for it. If you're running AOE_Scheduler and you're running a cron trigger (cron.php) every 15 minutes, you need to set the AOE_Scheduler Heartbeat Task Schedule appropriately to be every 15 minutes.

enter image description here

2
  • Can you provide an example on this alone please. "call cron.php periodically by calling it remotely with curl or wget."
    – Dev
    Feb 21, 2015 at 5:09
  • I am running cron.php from my browser periodically and schedule generates, However status are pending,... think it should completes after scheduled time
    – Dev
    Feb 21, 2015 at 5:13
2

Normally Magento would push a cron error via email to the email address you have entered in the Admin for this. Optionally errors would be logged to exception.log in the var/log directory.

[EDIT]

You can monitor your cronjob activity with Aoe_Scheduler. That might also give you some more insight into whats going on.

[END EDIT]

I usually turn of logging since it's not very useful and does a lot of queries per page view. You can turn them off via a modules config.xml by adding

<frontend>
        <events>
            <controller_action_predispatch>
                <observers><log><type>disabled</type></log></observers>
            </controller_action_predispatch>
            <controller_action_postdispatch>
                <observers><log><type>disabled</type></log></observers>
            </controller_action_postdispatch>
            <customer_login>
                <observers><log><type>disabled</type></log></observers>
            </customer_login>
            <customer_logout>
                <observers><log><type>disabled</type></log></observers>
            </customer_logout>
            <sales_quote_save_after>
                <observers><log><type>disabled</type></log></observers>
            </sales_quote_save_after>
            <checkout_quote_destroy>
                <observers><log><type>disabled</type></log></observers>
            </checkout_quote_destroy>
        </events>
    </frontend>

Or just download the module I've build for this. https://github.com/sandermangel/sama_disablelog

9
  • Hi I have enabled my exception and set error notifying email. However I haven't received email notice or error log
    – Dev
    Feb 20, 2015 at 7:31
  • There might be a fatal error. Di you check the apache errors logs?
    – Sander Mangel
    Feb 20, 2015 at 7:32
  • IF so it should print via browser isn't?
    – Dev
    Feb 20, 2015 at 7:39
  • Depends on your settings, on production I never output errors to screen. And a cronjob runs from the commandline
    – Sander Mangel
    Feb 20, 2015 at 7:40
  • There is no fatal error Sander... I am sure about that but not about cron
    – Dev
    Feb 20, 2015 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.