Magento 2: Display Exception Logging

Magento 2: Display Exception Logging

The Magento 2 system, by default, will not have robust or exception logging enabled for global display. If you encounter an issue where the Magento 2 system is displaying that there is an issue but the application is not set to display errors it will output a generic error page, as seen below:

Application_Magento2_Linux_Maintenance_Mode

To allow the Magento 2 system to display errors you will need to modify the system settings. There are two ways that you can perform this:

Option 1: Administrator Dashboard

  1. The “safest” way of performing this action would be to access the administrator dashboard and to navigate to the System category, click on Configuration and then select “Developer.”
  2. Next, open the “Log Settings” section.
  3. Change the “Enabled” setting to “Yes.”
  4. Finally, click ** “Save Config.” **

Option 2: File Structure

  1. If for whatever reason you are unable to access the admin area, another method would be to manipulate the core files and navigate to the Magento root directory.

  2. Next, navigate to the error directory located /pub/error and re-name the local.xml.sample file to local.xml

  3. If Necessary, In doing this you may end up putting the site into a maintenance mode accidentally. This is rare but can happen. If it does you will need to use CLI to bring the site out of maintenance mode.

    • Linux OS: access the server through SSH and navigate to the webroot Magento directory and run the following: "php bin/magento maintenance:disable"

    • Windows OS: access the server through RDP then open a CMD or PowerShell prompt and navigate to the PHP version directory that the client site is currently set to and then run the following: "./php.exe C:\home[insert domain here]\wwwroot\bin\magento maintenance:disable"

This will allow for the Magento 2 site instance to display the error output and identify the source of the error to the best of the platform’s ability. The Magento 2 error logging is rather verbose with PHP errors but can only present generic errors if there is a database issue.