Your Search Bar For Side Hustle Tips

Where Is Wordpress Log File

|Blog Argute

If you are troubleshooting a WordPress website, you may be looking for its log file to find out why a plugin, theme, or custom feature is failing. The most common WordPress debug log location is wp-content/debug.log, but WordPress does not necessarily create this file automatically. You usually need to enable debugging first, and your web host may also store PHP or server errors in a separate location. Here is how to find the right log, turn it on safely, and use it to investigate common problems.

Where Is the WordPress Log File?

When WordPress debugging is enabled with the standard settings, the debug log is usually located at:

your-website-root/wp-content/debug.log

The website root is the directory containing files such as wp-config.php, wp-admin, and wp-includes. The wp-content folder is normally inside that directory, alongside the themes, plugins, and uploads folders.

For example, if WordPress is installed in a directory called public_html, the file may be at public_html/wp-content/debug.log. If your WordPress installation is in a subdirectory, such as public_html/blog, look for public_html/blog/wp-content/debug.log.

This location is a default, not a guarantee. The file may not exist until an error is recorded, your hosting provider may use a different logging system, or your site configuration may specify a custom location.

Does WordPress Create a Log File Automatically?

Usually, no. A standard WordPress installation does not always write errors to wp-content/debug.log. The log is created or updated when debugging is configured and WordPress or related PHP code produces an error or notice that can be logged.

WordPress has a debugging mode controlled by constants in wp-config.php. The key settings are WP_DEBUG, which enables WordPress debugging, and WP_DEBUG_LOG, which sends eligible messages to a file. If these settings are off, the debug log may be absent even when you know an error occurred.

Also keep in mind that not every failure appears in the WordPress debug log. A server outage, a PHP configuration problem, or an error that happens before WordPress loads may be recorded only in your hosting account’s PHP or server error logs.

How to Enable the WordPress Debug Log

Before changing your configuration, make a backup of wp-config.php. A syntax mistake in this file can prevent WordPress from loading. You can edit it using your hosting file manager, an SFTP client, or a secure file-management tool supplied by your host.

Open wp-config.php in the WordPress installation directory. Find the line that says /* That's all, stop editing! Happy publishing. */ and add the following settings above it:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Save the file, then repeat the action that caused the problem. For example, reload the page, activate the plugin, or submit the form again. If WordPress records a reportable message, check wp-content/debug.log.

The settings work together in a specific way. WP_DEBUG enables debugging, while WP_DEBUG_LOG directs messages to a log file. WP_DEBUG_DISPLAY controls whether errors are printed on pages viewed by visitors. Setting it to false helps keep technical error details off the public-facing site while you investigate.

If these constants already appear in wp-config.php, do not add duplicate definitions. Update the existing values instead. A constant should normally be defined only once; defining it again can cause warnings or make it unclear which setting is being used.

How to Find and Open debug.log

Once logging is enabled and an error has occurred, use one of these methods to look for the file:

  • Hosting file manager: Sign in to your hosting control panel, open the website’s document root, and navigate to wp-content. Look for debug.log.
  • SFTP: Connect with your SFTP application, browse to the WordPress installation, and open the file in wp-content. Download a copy if you want to review it locally.
  • SSH: If your hosting plan provides terminal access, navigate to the WordPress directory and inspect the file with a command such as tail -n 50 wp-content/debug.log.

Depending on your permissions and hosting setup, you may be able to read the file but not edit it. Avoid changing permissions to make files broadly writable. If you cannot access the directory, ask your host for the correct account permissions or a safe way to retrieve the log.

The newest entries are generally near the bottom of the file. If it is large, look at the final lines first and note the time of each message. You can compare those timestamps with the moment the issue occurred.

Choosing a Custom WordPress Log Location

You can configure WP_DEBUG_LOG to use a custom file path instead of the default. This can be useful if your host blocks access to files in wp-content or you want the log stored somewhere less exposed. For example:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/path/to/private-directory/wordpress-debug.log' );
define( 'WP_DEBUG_DISPLAY', false );

Replace the example path with a real, writable location on your server. An absolute path is generally clearer than a relative one, but the correct path depends on your hosting environment. If you are unsure how to find it, check your hosting documentation or contact support.

Keep in mind that custom locations can behave differently under hosting restrictions, and a directory that is not writable will prevent the log from being created. Test the configuration and confirm that new entries appear before relying on it.

What Is the Difference Between WordPress and Server Logs?

The WordPress debug log is only one source of diagnostic information. It records messages from WordPress and PHP code that runs as part of the site, provided logging is configured and the messages are eligible to be recorded.

Your hosting provider may separately maintain PHP error logs, web server logs, or application logs. These can contain information about errors that occur before WordPress starts, memory limits, server configuration, request failures, or access to pages and files. Their locations vary. You may find them in a hosting dashboard under labels such as “Errors,” “Logs,” or “Metrics,” or you may need to ask your provider.

Plugin and theme developers may also create their own logs. A backup plugin, payment integration, or security tool might record events in its settings area, in a plugin-specific directory, or in a separate service. If the WordPress debug log does not show the issue, check the relevant plugin’s documentation and settings.

How to Read WordPress Debug Log Entries

A log entry often includes the type of message, its date and time, and the file and line number associated with it. For example, a message might identify a PHP warning in a plugin file. That information can help you identify what was running when the problem occurred.

Look for repeated entries and compare their timestamps with the issue. A single notice may not explain a broken page, while a fatal error close to the failure time may point directly to the cause. The file path can reveal whether the message is associated with WordPress core, a theme, or a plugin.

A log message is a clue, not always a complete diagnosis. For instance, the file named in an error may be where a problem became visible rather than where it began. If you are not comfortable interpreting PHP errors, share the relevant lines with a developer or your hosting provider, but remove private information first.

WordPress Log File Security and Cleanup

Debug logs can reveal file paths, software versions, database-related details, or other information you should not expose publicly. Do not leave debugging enabled indefinitely on a live website. After investigating the issue, turn it off by restoring your previous settings, usually by setting WP_DEBUG to false or removing the temporary debug configuration.

Delete or securely archive the log when it is no longer needed. Before removing it, confirm that you have saved any information required for troubleshooting. If the file is large, it may be filling available storage or slowing down file-management tools.

Because wp-content is commonly accessible as part of a website, do not assume that debug.log is private simply because it is not linked from a page. Ask your hosting provider how to prevent public access, or store the log outside the web-accessible directory when your setup allows it. Avoid adding protection rules unless you understand how they interact with your server configuration.

Why Is debug.log Missing or Empty?

If you cannot find the file, check these common causes:

  • Debugging is not enabled: Confirm that WP_DEBUG and WP_DEBUG_LOG are set correctly in the active installation’s wp-config.php.
  • The settings are in the wrong place: Make sure the definitions appear before the line that says WordPress should stop editing wp-config.php.
  • The error has not happened again: Enable logging, reproduce the issue, and check the file afterward.
  • The path is different: Look for a custom WP_DEBUG_LOG value or check your host’s PHP error log.
  • The directory cannot be written to: Ask your provider to check the file and folder permissions rather than making them broadly writable yourself.
  • The issue occurs before WordPress loads: A server-level or PHP error log may contain the relevant details instead.
  • Your host manages logging: Some managed WordPress hosts provide logs through a dashboard and may restrict direct access to files.

If you are using multisite or more than one WordPress installation, verify that you are checking the correct site’s configuration and content directory. Each installation may have its own settings and log location.

Frequently Asked Questions

Is WordPress debug.log the same as an activity log? No. The debug log is intended to record debugging and error messages. An activity log tracks actions such as user logins, content changes, or plugin updates and usually requires a separate plugin or service.

Can I view the WordPress log in the dashboard? WordPress does not provide a standard dashboard screen for browsing debug.log. You will usually need a hosting file manager, SFTP, SSH, or a tool provided by your host. Be cautious with plugins that display sensitive log contents to users who should not have access.

Should I keep debugging enabled on a live site? It is best to use debugging temporarily. Keep errors hidden from visitors, limit access to log files, and disable debugging when troubleshooting is complete. For ongoing production monitoring, use a solution designed for secure error reporting.

Conclusion

The standard WordPress debug log is usually wp-content/debug.log, but it appears only when logging is configured and a message is recorded. Enable WP_DEBUG and WP_DEBUG_LOG in wp-config.php, keep WP_DEBUG_DISPLAY off on public pages, and reproduce the issue before checking the file. If the log is missing, consult your hosting provider’s PHP or server logs and check for a custom log path. Once troubleshooting is finished, disable debugging and protect or remove the log to reduce the chance of exposing sensitive information.