Magento does some excessive logging to track customers. This in return causes your Magento database to expand exponentially in size, and inevitably decreases your sites overall performance.
I found that disabling logging from the Magento admin does not stop Magento from writing to the log tables in the database. To tell Magento to completely stop, do the following.
1. Open your app/etc/local.xml file
2. Paste in the following, right before the </config>
closing tag:
<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>
3. Save your local.xml file
4. Now to go System > Configuration > Advanced and set Mage_Log to Disable
5. Finally, flush your Magento caches under System > Cache Management
Magento should no longer write logs to these tables.
To clean out your existing log tables, just run the following SQL command against your Magento database.
WARNING: Once you truncate these tables, the log information will be permanently lost. If you have no need for this log data, then by all means get rid of it!
TRUNCATE log_customer; TRUNCATE log_quote; TRUNCATE log_summary; TRUNCATE log_summary_type; TRUNCATE log_url; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE log_visitor_info; TRUNCATE log_visitor_online; TRUNCATE report_event;
Why not just to disable Mage_Log module in Mage_All.xml config?
I tried that, however the Mage_Log module is more for the debug logs created in the filesystem (not the database). My method above disables logging made on the database (customer logins, abandoned cart logs etc).
I agree with you. Also I found that disabling Mage_Log module can break compare products functionality.
be careful! The product comparing does not work correctly if you disable the visitor log
We’re using this to clean up one of our clients’ databases. Would you believe the log table was 3Gigs in size before they approached us to assist for the project!!
It’s a popular online e-commerce hyperlocal grocery site
bit of a dirty and nasty hack…but I disabled logs by commenting out line.
//$adapter->insert($this->getTable(‘log/visitor_info’), $bind);
on line 174 in /app/code/core/Mage/Log/Model/Resource/Visitor.php
I should probably say, I disabled customer visitor information logs by commenting out that line above. Not every log.