Magento 2 Developement

Error Reporting In Magento 2

If you got similar message you might be curios how to enable error reporting in magento 2 instead of checking log file in /var/report folder.

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: XXXXXXXXXXXX

By default Magento 2 run in “default” mode : Exceptions are not displayed to the user; instead, exceptions are written to log files. To enable error reporting in this mode you need to rename local.xml.sample to local.xml within pub/errors directory.

You should run the Magento software in “developer” mode when you’re extending or customizing it. Uncaught exceptions display in the browser and exception is thrown in the error handler, rather than being logged. To switch to developer mode you need to perform following actions:

  • delete the contents of the var/generation and var/di directories:
    rm -rf <your Magento install dir>/var/di/* <your Magento install dir>/var/generation/* 
  • Set the mode:
    magento deploy:mode:set developer

    The following message displays:

    Switched to developer mode.

Useful links:
Magento modes
Change magento mode

Leave a Reply

Your email address will not be published. Required fields are marked *