1

Is it possible to enable system/exception logging in Magento through local.xml, instead of doing it by DB saved settings?

Or at least via code (but changing the setting only for one particular execution, without changing the configuration in the DB)?

What I'm after is to be able to have a different configuration for dev/production, one with log enable and the other without logging). And even if I'm not using the same DBs, every time we download the production DB to continue testing we have to reset settings.

2
  • where you need? Default log for exception in exception.log.
    – Sohel Rana
    Apr 7, 2016 at 14:20
  • The default logs. To enable the same behavior as in going to settings (System > Configuration > Developer > Log Settings ) and enable logging.
    – yivi
    Apr 7, 2016 at 14:34

1 Answer 1

3

To enable logging programmatically, you can do:

Mage::getModel('core/config')->saveConfig('dev/log/active',true);

To disable it:

Mage::getModel('core/config')->saveConfig('dev/log/active',false);
3
  • While it works, it would be nice to be able to alter the settings only temporarily. An equivalent to WP_DEBUG=true, or php's display_errors()...
    – yivi
    Apr 7, 2016 at 14:54
  • via local.xml would be the perfect place. I thought it would be doable...
    – yivi
    Apr 7, 2016 at 14:54
  • @yivi unfortunately I'm not aware of any temporary way of doing it Apr 7, 2016 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.