Getting StartedServersSitesGitDevelopersTeams When you install a WordPress
site via SpinupWP, both The debug.log file is stored in a publicly accessible location. Meaning anyone can view your error logs simply by visiting the log file’s URL
(acmepublishing.com/wp-content/debug.log). This can expose potentially sensitive information about your server to would-be hackers. Log files can grow exponentially in size when left unmonitored. This is especially true of WordPress debug.log, which can quickly fill up due to errors and warnings caused by WordPress themes and plugins. SpinupWP mitigates both of these issues, allowing you to utilize debug.log without the disadvantages. By default, WordPress saves debug.log to the Since most people expect the debug.log to be located in the Nginx is configured to disallow access to .log files. This is achieved via the following Nginx location block: logrotate is configured to rotate, compress and remove old log files. All We do not recommend that you
enable
Your plugin or theme developer may have asked you to provide them with debugging logs (also known as WP-DEBUG). These logs are turned off by default, as leaving them on can lead to some very very large log files, which can slow down your site and will count against your storage limit. Enable Debug logsYou can turn Debug logging on by making an edit to your site’s Connect to your site via SFTP. Once connected, look for your site’s Open this file in the text editor of your choice. By default, logging is turned off, so
you’ll see a line that says: Remove that and replace it with the following:
Save your changes and make sure the updated file is on your site. Once errors are generated, a Once done, don’t forget to turn debugging off! Remove the code you added to your No one likes to see errors on their website. Not only do they look bad to visitors and potential customers, but they also indicate that something’s wrong. But they’re, unfortunately, an inevitable part of running a site. The good news is that following a few best practices and being proactive can dramatically reduce the number of errors you experience. One way to monitor potential site issues — or troubleshoot existing ones — is to keep and review an error log. Let’s dive into this a bit more. What is error logging and why is it important?Error logging is the process of tracking and monitoring issues that occur on a website. This is usually done with a record of simple text files that live on your web server and are updated whenever an error occurs. Error logs are used to identify the number of problems that occur, provide details about each one, and show when it took place. How to enable error loggingTo enable error logging on your WordPress site, you’ll need sFTP access, available with WordPress.com plugin-enabled plans. This allows you to edit your website files remotely. In this case, you’ll be working with the wp-config.php file, which holds the basic configuration settings for your website. A word of warning: you should only use sFTP and edit your wp-config.php file if you feel comfortable doing so. Mistakes can cause catastrophic errors on your website. If you don’t have experience changing these types of files, you may want to hire a developer or reach out to WordPress.com support for help. 1. Connect to your website via sFTPYou’ll need to start by enabling sFTP on your site. Go to My Site(s) → Settings → Hosting Configuration and click the Enable SFTP button. Then, you’ll see your sFTP login details: URL, Port Number, Username, and Password. You’ll need to input these into FTP software, like FileZilla, to access your site. Follow these detailed instructions to connect to your WordPress.com website. 2. Find and download your wp-config.php fileNavigate to your wp-config.php file. This sits in the root directory of your file structure, alongside folders such as wp-content. Download this file, so you have a backup copy on hand. 3. Edit the wp-config.php fileEdit your wp-config.php file using a text editor such as Notepad. Look for define( ‘WP_DEBUG’, false ); and replace this text with the following: define( ‘WP_DEBUG’, true ); if ( WP_DEBUG ) { @error_reporting( E_ALL ); @ini_set( ‘log_errors’, true ); @ini_set( ‘log_errors_max_len’, ‘0’ ); define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); define( ‘CONCATENATE_SCRIPTS’, false ); define( ‘SAVEQUERIES’, true ); } You’ve now successfully enabled error logging. You should only have this feature turned on while troubleshooting. Otherwise, it can leave your site more vulnerable to hacking attempts. To disable logging, simply delete the code you just added and restore the following: define( ‘WP_DEBUG’, false ); How to view the error log manuallyOnce the log is enabled, you’ll need to load your website to trigger any error codes. Those codes are stored in a file called debug.log, which you can access via sFTP by following the same steps as above. You can find the debug.log file inside of the wp-content folder. If there are errors, the file will appear. However, if there aren’t any errors, then you won’t see it at all — congratulations! Once you find the file, download it to your computer to view the full log, using a text editing software like Notepad. It will look something like this: This file will provide valuable information that will point you, or your developer, to the source of your problem. How to view the error log using a pluginUsing a plugin to find your error log can be an easier and faster method, depending on your level of experience. In the WordPress dashboard, click on Plugins → Add New. Search for “Error Log Monitor” and click Install → Activate. This plugin installs a widget on your WordPress dashboard that allows you to access your error log. If you haven’t enabled error logging correctly, the widget will display instructions on how to do so. However, you should ignore these instructions, as they’re incorrect for a WordPress.com installation. Instead, use the ones listed above. If you can’t see the dashboard widget, click on the Screen options tab at the top of the WordPress dashboard and ensure that “PHP error log” is checked. How to find the plugin or theme that’s causing an errorError logs are not inherently easy to read, but they do give insightful information into the cause of an error. Typically, each line in your error log will display a message, alongside the date and time it happened and the file in which the error occurred. It also lists the line number where the error is located. For example: Apr 20, 15:08:59 Notice: Undefined index: fg2 in /wordpress/themes/pub/varia/functions.php on line 166 Let’s break this down. First of all, there’s the date and time of the error: April 20, 15:08:59. This helps you determine if this was a one-off glitch or a recurring issue. Then, you can see the type of error that’s been logged. Here are a few common types of error you may see here:
In this case, the error is a notice. Next, we see the error itself. In the example above the error is “undefined index.” This is followed by the specific location of the problem. In the above example, the error is occurring with the functions.php file of the Varia theme. How to fix errorsNow that you can see your errors, it’s time to troubleshoot. Here’s a few things you can try:
Troubleshooting with the WordPress error logWordPress, like any software, may occasionally run into problems. It may seem confusing to find and fix those problems, but the error log can be a huge help! It enables you to learn valuable information that can help you troubleshoot and solve site errors in a timely manner. To avoid errors, always use well-maintained plugins and themes, and keep on top of updates. Need more help? If you have a WordPress plugin-enabled plan, you benefit from world-class Happiness Engineers that can provide guidance. How do I find the log file in WordPress?How to Enable WordPress Logs to Track Website Errors (In 3 Steps). Step 1: Access Your Website's Files. To activate your WordPress logs, you'll need direct access to your site's files. ... . Step 2: Edit Your wp-config. php File. ... . Step 3: Locate Your New WordPress Logs. Your WordPress logs are now ready to go.. How do I access debug in WordPress?Viewing the debug log
In the dropdown menu, click the “View File” option. This will open a new tab showing the errors in the debug log. Method 2 – Manually: access your site files and navigate to the following path public_html/wp-content/debug. log – open the file to view the errors in the debug log.
Does WordPress have a log file?To look at your WordPress error logs you need to navigate to your /wp-content/ folder in your File Manager. There you need to locate the debug. log file. This is the file that will contain all WordPress errors, warnings, and notices that were logged.
Can I delete the debug log file WordPress?Log into WordPress and go to: s2Member → Log Files (Debug) → Logs Viewer. There you will find a link near the top that reads, "Debugging Tools/Tips & Other Important Details". Click the link to toggle those tools, and then choose, "Permanently Delete All Log Files".
|