I'm trying to fully understand Magento's error handling.
I noticed that sometimes if a fatal error occurs, a report is created in var/report
(and an email is sent – depending on configuration) and on other occasions an error message is logged in var/log/exception.log
. This all happens on the same installation, so it can't be a configuration thing.
How does Magento decide where to store an error message?
Best Answer
So the default behavior for an uncatched error (when developer mode is deactivated) is to create a report. That ultimate catch is handled in the Mage.php:
If you dig deeper into printException you can see that it decides if dev mode is activated or not. If it's activated it'll just output the exception and in production mode prepare the data and include errors/report.php.
errors/reports.php itself just calls the processor and stores the report:
So, but where is the exception.log coming from? That's written when Mage::logException is called:
An that static function is manually called in over 100 plcaes over the Magento Core, especially when an exception is catched, should be logged, but not thrown to the top of Mage::init to continue the current process.