How to Enable Magento Error Log
The message will pop up on Magento based on your server's stage, whether in developer or production mode.
Switch your Magento store to developer mode if you are in a mode of debugging a problem on production server. This will make the process of identifying the errors and rectifying them easier.
Table of Contents :
-
If you are facing issues like your Magento store displays a blank page with the error numbers, a plain white page, broken content error or 500 Internal servers, follow the below process to debug your Magento store.
-
ATTENTION: Enable the logging feature as required. If left enabled for a longer time, the logs will occupy the significant space in your disk and slow down the website speed.
-
Enable error reporting to check Blank White Page.
If there is a blank white page error in your Magento page, then this is a fatal PHP error that can't be recovered.
So, for the security reasons server tends to configured by default to hide the error message as it contains sensitive information.
The best and smoothest way of debugging a blank page error is to know the root of the problem that created it.
1. First, you need to check your apache or PHP errors and for that, connect your server with FTP, SSH. Now either connect with your hosting provider and raise a ticket to access your error log files or use cPanel file manager.
2. If you are facing a problem finding the location f your error log files, you can forcefully print the below message to your browser by editing your index.php file as shown below:
error_reporting(E_ALL);ini_set('display_errors', 1);
Eg. index.php
...error_reporting(E_ALL);ini_set('display_errors', 1);try { require DIR .'/app/bootstrap.php'; } catch (\Exception $e) { ...... }
If you don't want your users to see the sensitive information, you can comfortably hard code your IP address to the only show error message on your IP address. How you can do it is tailored below, follow the coding and safeguard your information.
$customIPAddress = ['your IP address here'];if (in_array($_SERVER["REMOTE_ADDR"], $customIPAddress) { error_reporting(E_ALL); ini_set('display_errors', 1);}
Also Read: What Are The Things That Will Change If You Shift To Magento 2 From Magento 1?
-
After Enabling error reporting, it Displays Blank White Page With information sensitive Error Message
To check the error shown, you can easily visit the SSH server and drag your cursor to the var/folder/report of Magento 2, learn the name of the file and read the error message easily. This will make your job easier and smoother.
-
After Enable error reporting Rectify Broken Content Error
The broken content error with missing footer occurs mostly when PHP encounters an error while outputting the page content that stops PHP from working.
To identify and rectify the error, press Ctrl+U browse through the page source, then scroll through the page's bottom and check there is any error information or message.
If you are unable to find any error, then enable the error reporting and give it a shot again!
-
In short, you need to follow the below-given steps:
- Check apache, NGINX, or PHP error logs in Magento 2 folder, var, or log.
- Check Magento 2 error folder in root var folder
- Check the mode of your Magento, developer, default, or production.
- Check out your PHP error website log settings.
Also Read: How To Check Your Magento Version
-
Now you know how to enable the Magento Error log. So, follow the above-listed steps and coding to enable your Magento error log in your Magento 2 store or connect with us for more information.