11

I was disabling the log_% tables when I realized it would be convenient to put the configuration in its own xml file. So I started looking for how the xml files in app/etc/ are included. When I couldn't find direct references to anything other than local.xml, and I know enterprise.xml is included, I tried an experiment: I added a properly formatted config file called 'nolog.xml' (below) and restarted Apache.

<?xml version="1.0"?>
<config>
  <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>
</config>

Sure enough, my logs are still not getting written to. I'm just looking for a sanity check here: Can I put any *.xml file in app/etc and expect Magento to include it?

kojiro
  • 1,048
  • 12
  • 22
  • 1
    BTW, you shouldn't need to restart Apache if you've only changed Magento configs. You might, however, need to clear the config cache if it's enabled. – Luke Mills Jun 05 '13 at 02:43

1 Answers1

12

Yes, you can. It's part of Magento's standard configuration loading to look for any file named *.xml in this folder. Specifically, the following code does that.

#File: app/code/core/Mage/Core/Model/Config.php
$etcDir = $this->getOptions()->getEtcDir();
$files = glob($etcDir.DS.'*.xml');

Also, a too long for StackExchange self-link that covers more than you ever wanted to know about configuration loading.

Alana Storm
  • 44,345
  • 35
  • 168
  • 353