How to Enable Error Messages in Magento 1 and Magento 2

February 17, 2015 Artem Demidov Magento
How to Enable Error Messages in Magento 1 and Magento 2

While working on online stores or extensions every Magento developer needs debug information about errors in the code. Also the information about exceptions that is generated by Magento can be very useful for developers. There are some powerful tools in Magento to obtain this information: log of exceptions and error messages (error reporting). In this article I will tell you how to activate these features in Magento.

Before enabling error messages (or exceptions log) it is necessary to disable caching and compilation in the Magento administrative panel.

To disable the cache you need to go to Cache Management and run the following steps:

System > Cache Management > Select All [check-boxes] > Actions = Disable > Submit

1to Enable Error Messages

To disable the compilation you need to go to the compilation settings and run the following steps:

System > Tools > Compilation > Disable

2to Enable Error Messages

To enable the error messages (error reporting) you need to complete the following steps:

  • Go to the Magento root directory
  • Open the index.php file
  • In the index.php file, uncomment the following lines:

  • Enable the Developer Mode. This can be done in two ways:

– Add the following command at the beginning of the index.php file:

– Add the following line to the .htaccess file

Note: The default error message is written to a text file whitch you can find in the directory: [magento root folder]/var/report. The file name looks like this 1184355013245.txt, where filename is the error code. It is possible not to write the error message into the file, but to display it on screen. To do this, go to the directory [magento root folder]/errors and rename the file from local.xml.sample to local.xml. You can also send an error message via email. In order to do this you need to specify the email address in the file [magento root folder]/errors/local.xml, section email_address.

To enable the log in Magento you need to go to the system configuration:

System > Configuration > Advanced > Developer > Log Settings > Enabled => Yes

3to Enable Error Messages

And there you have it. All is ready for the intense debugging process!

Magento 2

As for Magento 2, you’ll have to set deployment mode of your Magento 2 installation to a developer. To do this login into your server terminal and enter this command under Magento file system owner:

php bin/magento deploy:mode:set developer

Then go to pub/errors folder and rename local.xml.sample file into local.xml. If you still can’t see errors on screen then uncomment #11 line in app/bootstrap.php



2 comments

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *