Searching for how to enable WordPress logs? We got it coved here in this article.
As per the recent study over 33% of websites is on the internet are created using WordPress. So you must have worked on WordPress sites at least once in your life to date. If you ever used WordPress site you must know the as easy its use its even frustrating to identify and solve its bugs, because many time you see hell numbers of things not working on your website but you got no idea what bugs are causing this and how to solve them.
So in this article, we are going to see how we can access our WordPress log file and how we can enable WordPress to debug mode using different methods. So we are going to use 3 methods here
Using an FTP connection
So let’s get started.
1.Using Ftp connection
When using the FTP connection we can divide into also 3 major steps.
1. Connecting your websites FTP server and accessing File.
- Finding wp-config.php file and Editing it for enabling WordPress Logs
- Locating WordPress Log file
Step1. Connecting your websites to FTP server and accessing Files
To connect your websites FTP connection, You need its FTP logging details as well as your website FTP server address. Which is normally is as follows ftp://ftp.yourdomain.com or just ftp://yourdomain.com but this can be different if it’s manually set by you or your hosting company. So best is always to contact them if you don’t know your FTP access details.
Now to connect FTP you need an FTP based software. Here we going to use FileZilla so if you don’t have Filezilla you can download it free and install. Now once you installed it next on opening it will ask your website FTP details. Fill it and you will be able to access your Html_public folder.
Now once you have successfully connected to the FTP server using a quick connect method, you will see a success message with all your folders and files of the website.
2.Finding wp-config.php file and Editing it for enabling WordPress Logs
Now you will see four main sections on your screen. Focus on the top right corner. This section window will contain new folders example – the primary ( root) directory of your WordPress. In some cases, it may even be called www or root or might be the as same name of your domain name ( mostly in case of hosting where the website has been added as the addons on a primary domain hosting ).
Once you double click you will see a new list of folders example – wp-admin, wp-content, etc scroll down you will start to see the notepad files containing .php extension file. Here find the Wp-config.php file.
Note: When editing makes sure to download a local copy of this file just for backup in case something goes wrong.
Now right-click on it and View/edit. It will open the file in your default text editor. which is mostly notepad. Next, you have to scroll down, search the line ./* That’s all, stop editing! Happy blogging. */.
Now you will need to put the following code above that line.
define( ‘WP_DEBUG’, true );
Now what this code means is it enables your WordPress Debug mode enabled. This is by default should be off but in some cases, you may find this code already there and should turn off debug mode as soon as you are done with your problem. using the following code.
define( ‘WP_DEBUG’, false );
Now doing this you will only enable debugging mode. Now next we need to enable WordPress Logs generation and store into a file. For this, you need to enter the following command just below the dubbing mode line.
define( ‘WP_DEBUG_LOG’, true );
With this, you are telling WordPress to keep all records of WordPress logs of any errors occurring during the runtime of WordPress.Now with these two lines of codes you are done with wp-config.php file work. Save it and exit. It might ask you to replace the older version of the wp-config.php file. Then click Yes and replace it with a newer one.
3.Finding Your WordPress Logs and debug log file
Now your WordPress is in debug mode and its ready to generate the WordPress Logs files. However, before you can generate a report or you can see what errors it’s storing you need to run your WordPress or website pages to let those errors run again then only. Your WordPress Logs file will be generated. Make sense right how it can collect logs when no error occurred.
Now we assume you surf through your website and run through previous errors again. Now your WordPress logs must be ready.
You need to again open your FTP and go into your root folder. This time find Wp-content folder, and scroll down for a new file name “debug.log”. Click on it and open it in view mode. You will see a list of errors, warnings, and any other issues that might be happened on your site after activating your WordPress logs.
If you found the error log. Now you have choices you can figure out on your own and solve it don’t ignore it. Sometimes errors are shown but the website works fine and people become lazy and let them stay at it. This might cause your website breakdown in the future. This is sailing a ship with a tiny leakage, it might be able to sail but if that small hole didn’t get fixed it might be sink ship in the near future.
This is the most common way to enable debugging mode, however, many times you might be working on one of your client websites,where the client only shares the FTP access with developers so we cover the FTP section first.
cPanel and FTP methods are pretty much the same . For cPanel you login into using your cPanel using your hosting account. In cPanel you will go to file manager Click on it and open your browser file manger . In there go to root folder or Public_html.
From there on you can follow as same steps as the mention above for step 2 and 3 of FTP method for enabling your WordPress Logs .
We know also while working on this industry there might be clients who only give their developer login of WordPress Admin panel They are annoying but if only that’s all option you have you can’t do anything.
For such cases, you can use few plugins available on the wordpress.org.These plugins have basics of help to solve errors and show WordPress logs generating on your website.
For you can use the plugin. Error Log Monitor.
We all know WordPress is written in PHP language. Which has its own error reporting feature? As a default WordPress doesn’t show the logs and Errors until its too major and completely braking your website down. In such cases, this plugin can help identify those problems and errors of WordPress logs quickly. This helps you identify problems that might be caused by other plugins and address them quickly.
But we only recommend this method when you can’t use the above first two methods to create a WordPress logs file.
Our Thoughts about WordPress Debugging Mode And WordPress Logs
Having WordPress Logs will help you quickly identify the error type and what might be causing it. If you need help you can turn up for the WordPress forums and in there you copy-paste error in the search box to find its solution. If you find no previous solution you can open a new discussion and don’t forget to share your error log file screenshot there and other people with knowledge will surely help you out.
You might even copy-paste Error in the google search box and find articles about it. But don’t be lazy to let it stay there. So once you are finally able to solve this error. Congratulations but wait there is still some work left to do. Yes ! you forget to turn off your WordPress debug mode and WordPress Logs.
As soon as you are done with your debugging requirements and troubleshooting work. You should always disable it. You can keep this enable if your website in still testing mode or development mode but if it’s in live mode, It might cause a major slowdown of your website. Which no website owner wants right? and it might open a path for hackers. Since WordPress config.php file contains very sensitive information like database password etc.
Wp-cron.php the file does not come in error but it might be slowing down your website know more here: How to Disable WP-Cron (wp-cron.php) for better Performance