How to disable Magento logging to the database

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:


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;


  1. Why not just to disable Mage_Log module in Mage_All.xml config?

    • Axel (Author)

      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).

  2. I agree with you. Also I found that disabling Mage_Log module can break compare products functionality.

  3. amarok

    be careful! The product comparing does not work correctly if you disable the visitor log

  4. 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

  5. Pearce Stephens

    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

  6. Pearce Stephens

    I should probably say, I disabled customer visitor information logs by commenting out that line above. Not every log.

Trackbacks for this post

  1. How to Optimize Your Magento Store | London Web Designer
  2. How to Optimize Your Magento Store | VPS Hosting

Leave a Reply to Axel