Our blog
Magento More Detailed Exception Log
Magento has a nice feature which logs exceptions to file and then generally displays a non scary message to the site user. Its not always true, some exceptions do get through and then generate reports.
For exceptions that are caught and logged though, (if you have logging enabled) you will find the exception log in the var/logs folder. However the exception log only contains the getTraceAsString info, which is heavily truncated and often pretty much useless. To get around this you can modify the logException method in Mage.php.
Note, editing Mage.php directly is not generally a good idea and any edits will get nuked every time you upgrade. However for local development work this little edit is OK I think.
-
{
-
if (!self::getConfig()) {
-
return;
-
}
-
$file = Mage::getStoreConfig('dev/log/exception_file');
-
//self::log("n".$e->getTraceAsString(), Zend_Log::ERR, $file);
-
$exceptionString = "nnnLogged Exception:nn" . $e->getMessage() . "nn" . $e->getTraceAsString();
-
/*foreach($e->getTrace() as $t){
-
$exceptionString .= var_export($t, true);
-
}*/
-
}
Note I experimented with echoing out each trace as detailed in this post, however I found that this caused a fatal error due to some kind of recursion so I have commented it out. The only real change is that I have logged also the Exception message, which is generally the most useful bit of info and will actually help you understand what has gone wrong, in which file and on which line.
Hope this helps someone else out. If you have any suggestions on a cleaner or better way to do this please do post it / link it in the comments.
More...
Caktus Blog » Blog Archive » Remote logging with Python logging ...
Aspiration Hosting (MY & US)
Magento - The radical Ecommerce open source | Blog| Offshore ...
Ebook Magento Use Guilde-Developing For Magento, Magento design ...
Free Magento Themes for Your Web Store! | Templates.com
More Reading:
One Comments
|
note you may find Magento's exception logging a bit patchy. the line to log an exception is: PHP:
|
RSS Feed
admin
June 10th, 2009