How to Enable Error Messages in Magento 1 and Magento 2

Feb 17, 2015674Artem Demidov
How to Enable Error Messages in Magento 1 and Magento 2

While working on online store or extension every Magento developer needs debug information about errors in the code. Also the information about the exception that is generated by Magento can be very useful for developers. There are some powerful tools in Magento to obtain this information: exception log and error messages (you should enable 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 logs) in Magento you need to complete the following steps:

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

  • Enable or set the Developer Mode in Magento. 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 which 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 errors 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 the errors are still not shown on screen then uncomment #11 line in app/bootstrap.php


Tags:

6 Comments

  1. How can I enable developer mode in magento 2.2?
    I follow your manual but still face the codes error.

  2. Dear Kevin,

    unfortunately, it’s not possible to provide a qualitative answer without getting into details.
    Please contact our support department in case you need an individual consideration of the matter: store@belvg.com
    We’ll be happy to assist!

Post a new comment

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