In this blogpost we will learn how to see error logs of Magento directly on frontend rather then going to reports folder. As we know that Magento does not display error data directly on UI, it rather provide a file name which is found in var/report folder in Magento. This is a good thing and done for security reason, since we don’t want others to know about our file name and paths, which usually shows up in error track. The error reports are generated in text file which have their names in randomly generated number such as 657030389. You can open these files in any text editor to view the error message.
But, during your development phase sometime we want to get this message directly on frontend rather than reading files again and again as this saves our time also, for this we need to make several changes.
Go to pub/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.
Above was all about the developer, now what if any such issue appears in front of your customer, then it will not look good? You should display a good looking UI and message to end user. For that we can open the pub/errors/local.xml file and change the
<action>print</action> to <action>email</action>
This will show a nice form on front end, where user can email you back when they view the error message. You can also change style of this page then you can modify it in pub/errors/default/report.html