سؤال

I have small problem. I have created my own module at local, I'd like to add logs for save/edit/delete actions with Enterprise Logging module.

I have created logging.xml at etc dir

app/code/local/AB/Characteristic/etc

<logging>
<characteristic translate="label">
    <label>Characteristics</label>
    <expected_models>
        <characteristic__characteristic />
    </expected_models>
    <actions>
        <characteristic_adminhtml_characteristic_save>
            <action>save</action>
        </characteristic_adminhtml_characteristic_save>
    </actions>
</characteristic></logging>

What I am doing wrong? Nothing save at /admin/logging/.

هل كانت مفيدة؟

المحلول

In my opinion you have some confusions to write logging.xml. See my sample and I explain:
config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Ssd_Faq>
            <active>true</active>
            <codePool>local</codePool>
            <version>1.1.3</version>
        </Ssd_Faq>
    </modules>

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules> <!--here admin router uses adminhtml route and <actions> node should has value adminhtml_faq_save -->
                        <Ssd_Faq before="Mage_Adminhtml">Ssd_Faq_Adminhtml</Ssd_Faq>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <!-- here if you use custom route for admin
    <admin>
    <routers>
        <some_module_node>
            <use>admin</use>
            <args>
                <module>Some_Module</module>
                <frontName>someroute</frontName>
            </args>
        </some_module_node>
    </routers>
    </admin> -->
    <!-- some nodes -->
    <global>
        <models>
            <ssd_faq> <!-- ssd_faq is my custom model name and <expected_models> node should has value ssd_faq__faq in logging.xml -->
                <class>Ssd_Faq_Model</class>
                <resourceModel>ssd_faq_mysql4</resourceModel>
            </ssd_faq>
            <!-- some nodes -->
        </models>
        <!-- some nodes -->
    </global>
</config>

logging.xml:

<?xml version="1.0"?>
<logging>
    <Ssd_Faq translate="label">
        <label>FAQ</label>
        <expected_models>
            <ssd_faq__faq/> <!--my model name is ssd_faq and I have Faq.php in Model folder-->
        </expected_models>
        <actions>
            <adminhtml_faq_save> <!--I use adminhtml route and I have FaqController.php in controllers/Admihtml folder-->
                <action>save</action>
            </adminhtml_faq_save>
            <someroute_somecontroller_save> <!--If you use custom route-->
                <action>save</action>
            </someroute_somecontroller_save>
            <!-- if you have some doubts where to find nodes like someroute_somecontroller_save or adminhtml_faq_save, open your controller and write this little debug code in particular action: echo $this->getFullActionName();die; You should write wull action name in the actions node. --> 
        </actions>
    </Ssd_Faq>
</logging>

And finally you should turn on your logging through admin->configuration->admin->admin actions logging and check [Characteristics] and save configuration

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top