Magento Error Page and Troubleshooting

In this blog post, we will see how error message in magento are setup, and what our various option to error messages.

Standard Error Page

This is how the default standard error page in magento looks like

Magento Error Page

Magento Error Page

As we can see due to security reasons, magento doesn’t display the error message directly, instead it save the error stack trace to the file. This is a good thing, since you won’t want outside people to know about your file name and paths, which usually shows up in error track. So anyway, to view the error message you need to go to /var/report/ folder in magento. Here you would see a file with the error number as the filename, in our case the filename would be 567330089. This is a standard text file, open it in any text editor to view the error message.
But, if you want to view directly the error message in magento you need to make changes to your configuration file. Go to /errors/local.sample.xml and rename this file to /errors/local.xml. Now you would be able to view the error message in your web browser itself.Error Page
This is usually required when your developing your website, since you would like to view your error message faster. But in the a live site, it better for security feature to have the default magento page

Error Page Configuration

Another great feature, if in your production site you want your users not to see a report number etc, rather a nice error page with email options like shown here Magento Error Page with EMail.
You need to open the /errors/local.xml file and change the

<action>print</action>

to

<action>email</action>

This show a nice form on front end, where user can email you back when they view the error message. Also if you want to change the text/styles of this page the html file is located at /errors/default/report.html

Logging

Another important aspect of troubleshooting magento is error logs. To enable error logs to go Admin -> System -> Configuration. Open the “Developer” section, this is the last section on left navigation. There is a box for Tab Settings there, you need enable logging from there. Once logging is enabled, you will get error messages in /var/log folder.

PHP Error Messages

Sometime, there might be some php error’s but instead your would end up seeing a blank page. The reason is, by default all php error message are turned off in magento. To turn error message open the index.php of magento, located in based folder. There change this line

error_reporting(E_ALL | E_STRICT);

to

error_reporting(E_ALL);

and change

#ini_set('display_errors', 1);

to

ini_set('display_errors', 1);

I think, this is all that magento provides for debugging and troubleshooting error message. If your still not able to find your error, you need to contact an expert.

  • Esmaeel

    Hi

    Magento does not save the logs to /installdir/var/log !

    Thank you.Good Site-Good Posts-Good Articles

  • ali

    Hi manish

    How To Add The Google Plus on Homepage and product pages?