Websites show unexpected errors that make visitors panic.
Magento error reporting is a troubleshooting technique. It displays the error message on the Magento panel when something goes wrong.
Also, some Magento applications write error logs in preset location. For error reporting to work properly, we need to turn on log write to record logs.
At Bobcares, we often get requests from our customers to resolve Magento error reporting as part of our Server Management Services.
Today, we’ll see how our Support Engineers fix the Magento errors.
Enable error logging in Magento
First of all, we need to tweak the log settings to turn ON Magento error reporting.
Fortunately, in Magento 2.x, error logging is enabled by default, and requires no special configuration.
But, in Magento 1.x, we need to turn on log write, so the system starts recording logs.
Go to Magento Admin > Configuration > Advanced > Developer > Log setting & enable log settings.
How we set up Magento error reporting
In general, Magento errors can result in a blank page or error number like “Error log record number: 774937658839″. Unfortunately, the exact reason for the error will be unknown. In such cases, while troubleshooting, our Support Engineers enable error reporting in Magento files by executing the steps below.
1. Initially, we connect to the server as a root user and access the user account. Or, if you have only user access you can use a file manager or FTP.
2. Then, we open the errors directory & rename local.xml.sample file to local.xml.
3. Next, open index.php file & we add the following code at the end of the file.
error_reporting(E_ALL);
ini_set('display_errors', 1);
4. After we save the file, refresh the site home page to preview errors.
That’s how we report the error message in Magento.
How we troubleshoot problems with error reporting
Even after enabling error reporting, we often see customers reporting problems with it.
Let’s see how our Support Engineers solved the problem.
1. Wrong settings in the index.php file
In most cases, when there are incorrect settings in the index.php file, Magento website doesn’t display the error message on the browser.
Therefore, to solve this problem we took the following steps.
1. First, we disabled Cache Management by navigating to System > Cache Management > Select All [check-boxes] > Actions = Disable > Submit.
2. Next, we disabled compilation by selecting System > Tools > Compilation > Disable.
[Note:– Because before enabling error messages it is necessary to disable caching & compilation.]
3. Finally, we opened the index.php file under Magento root directory & added the following line at the beginning.
$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true
That fixed the problem & the user could display the error message in Magento website.
2. Permission issue
Recently, one of our customers had an issue regarding the error report in Magento. After migration, Magento was not writing logs in /var/report .
Usually, this problem occurs when there is no write permission in /var/report folder.
Therefore, to solve this permission problem, we corrected and added write permission on the corresponding folder.
That fixed the problem and the user could see Magento writing logs in the folder /var/report.
[Having trouble with Magento error reporting? We’ll fix it for you.]
Conclusion
In short, Magento error reporting is a good method to troubleshoot website errors. It gives a clear picture on the exact cause of error. Today, we saw how our Support Engineers enabled error reporting in Magento and fixed related errors.
0 Comments