magento禁止LOG,写入文件和写入数据库表。

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 TABLE  `index_process_event`;  
    TRUNCATE TABLE  `dataflow_batch_export`;  
    TRUNCATE TABLE  `dataflow_batch_import`;  
    TRUNCATE TABLE  `log_customer`;  
    TRUNCATE TABLE  `log_quote`;  
    TRUNCATE TABLE  `log_summary`;  
    TRUNCATE TABLE  `log_summary_type`;  
    TRUNCATE TABLE  `log_url`;  
    TRUNCATE TABLE  `log_url_info`;  
    TRUNCATE TABLE  `log_visitor`;  
    TRUNCATE TABLE  `log_visitor_info`;  
    TRUNCATE TABLE  `log_visitor_online`;  
    TRUNCATE TABLE  `report_viewed_product_index`;  
    TRUNCATE TABLE  `report_compared_product_index`;  
    TRUNCATE TABLE  `report_event`;  



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;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值