Which logs does a WordPress site actually have?

A WordPress site can write errors to three or four places, and each one sees different problems. Knowing which log to open saves most of the time a fault costs you.

Log Who writes it Where it usually lives What it catches
WordPress debug log PHP, when WP_DEBUG and WP_DEBUG_LOG are on wp-content/debug.log by default, or any path you set PHP fatal errors, warnings, notices and deprecations from core, plugins and themes
PHP error log PHP itself, set by the error_log setting A path chosen by the host; if unset, the web server’s own error log The same PHP messages, even when WordPress debugging is off
Web server error log Nginx (error_log) or Apache (ErrorLog) Often /var/log/nginx/ or /var/log/apache2/ on a server you manage Timeouts, permission errors, upstream failures, rewrite problems
Host panel logs Your hosting company A logs screen in the hosting panel Copies of the server and PHP logs on shared and managed hosting

Error logs on a typical WordPress site. Access logs record requests, not errors, so they are left out.

Start with the WordPress debug log for anything that looks like a plugin or theme fault. Go to the web server log when a page fails before PHP runs, for example a 502 or 504 error. Rather not dig through server files? Our website maintenance and care team reads and acts on these logs as part of a care plan.

This guide is about reading logs. If your site already shows “There has been a critical error on this website”, our guide to the WordPress critical error covers the repair steps.

How do you turn on WP_DEBUG_LOG without exposing errors?

Add these lines to wp-config.php, above the line that says “That’s all, stop editing”:

wp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/home/example/logs/wp-debug.log' ); // outside the web root
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', '0' );

Each line has a job:

  • WP_DEBUG turns on WordPress debug mode. It is false by default. Write true without quotes, because the string 'false' counts as true.
  • WP_DEBUG_LOG writes messages to a file. Set to true, it uses wp-content/debug.log. Set to a file path, it writes there instead.
  • WP_DEBUG_DISPLAY controls whether errors print into the page. Its default is true, so you must set it to false yourself.
  • display_errors is the PHP setting underneath. Turning it off covers code that runs before WordPress applies its own setting.

What happens if WP_DEBUG_DISPLAY stays on?

We tested it. We built a small must-use plugin, Lab Log Demo, that triggers one PHP message of each severity on request. Then we loaded the site twice: once with display off and once with display on.

With display on, a simple warning printed into the page above the HTML document, with the full server path:

curl /?lab=warning (display on, trimmed)
<b>Warning</b>:  Undefined array key "size" in <b>/wordpress/wp-content/mu-plugins/lab-log-demo.php</b> on line <b>10</b><br />

The fatal error was worse. With display off, the request failed with HTTP 500 and the normal critical error message. With display on, PHP printed the fatal error and the stack trace to the visitor, and the status was 200:

curl -D - /?lab=fatal (display on, trimmed)
HTTP/1.1 200 OK
x-powered-by: PHP/8.3.36
Fatal error:  Uncaught Error: Call to undefined function lab_missing_helper() in /wordpress/wp-content/mu-plugins/lab-log-demo.php:21
Stack trace:
#0 /wordpress/wp-includes/class-wp-hook.php(353): {closure}('')

That 200 matters twice. Visitors see your file layout, and uptime monitors that only check the status code report the page as healthy. Keep display off on any site the public can reach.

How do you read a PHP log line?

Every line has the same parts: a timestamp, a severity, a message, a file and a line number. This is the warning from our test, as it landed in the private log:

/srv/wp-logs/debug.log
[27-Nov-2026 09:35:03 UTC] PHP Warning:  Undefined array key "size" in /wordpress/wp-content/mu-plugins/lab-log-demo.php on line 10
  1. Timestamp [27-Nov-2026 09:35:03 UTC]: match it to the time a user reported the problem. Note the time zone.
  2. Severity PHP Warning: tells you how urgent it is (table below).
  3. Message: what PHP tried to do. Here, it read an array key that does not exist.
  4. File and line: the folder after wp-content/plugins/, wp-content/themes/ or wp-content/mu-plugins/ names the culprit.
Severity What happened to the request How urgent
PHP Fatal error Stopped. The visitor saw an error page. Fix now
PHP Warning Continued, but the code likely produced wrong output. Fix soon, especially if it repeats on every request
PHP Notice Continued. WordPress uses notices for “called incorrectly” messages. Fix in the next maintenance window
PHP Deprecated Continued. The code works on this PHP version only. Fix before the next PHP upgrade

PHP severities in a WordPress log and what they mean for the site

Why do some notices point to a WordPress core file?

WordPress raises “called incorrectly” notices from its own functions.php. The file and line in those lines are the reporter, not the cause. Our test notice ended like this:

/srv/wp-logs/debug.log (trimmed)
PHP Notice:  Function lab_log_demo was called <strong>incorrectly</strong>. Lab notice: called in the wrong place. ... (This message was added in version 6.0.0.) in /wordpress/wp-includes/functions.php on line 6260

Read the function name after “Function” instead. Search your plugins and theme for it to find the code that made the call.

Why should you care about Deprecated lines?

A deprecation is a warning about the future. Our test plugin passed null to strlen(), which PHP 8.3 still accepts:

/srv/wp-logs/debug.log
[27-Nov-2026 09:35:05 UTC] PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /wordpress/wp-content/mu-plugins/lab-log-demo.php on line 14

The page worked. But code that leans on deprecated behavior is the code that fails after a PHP upgrade. Our critical error guide shows one such failure, a plugin that worked on PHP 7.4 and broke every page on PHP 8.3.

How do you find the lines that matter in a large log?

A log on a busy site can hold thousands of repeated lines. Three commands cover most of the work. These ran against the debug log from our test after six requests.

terminal
# Count lines by severity
grep -oE "PHP (Fatal error|Warning|Notice|Deprecated)" debug.log | sort | uniq -c | sort -rn
output
      3 PHP Warning
      1 PHP Notice
      1 PHP Fatal error
      1 PHP Deprecated
terminal
# Show each fatal error with the first line of its stack trace
grep -A1 "PHP Fatal error" debug.log
output (trimmed)
[27-Nov-2026 09:37:00 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function lab_missing_helper() in /wordpress/wp-content/mu-plugins/lab-log-demo.php:21
Stack trace:
terminal
# Group repeats: strip the timestamp, then count identical messages
grep -E "PHP (Warning|Deprecated)" debug.log | sed -E 's/^\[[^]]+\] //' | sort | uniq -c | sort -rn

The last command turns a wall of repeats into a short list, with the noisiest message on top. To watch new lines arrive while you click through the site, run tail -f debug.log and stop it with Ctrl+C.

No shell access? Most hosting panels have a file manager that opens the log, and some offer a log viewer. Download the file and run the same searches on your own computer.

How large can debug.log get, and who rotates it?

Nothing in WordPress core trims or rotates the debug log. PHP appends one line per message, and a message in a template repeats on every page view.

In our test, the warning line was 132 bytes, and three page loads wrote three lines. As arithmetic, not a measurement: the same warning on a page with 10,000 views a day adds about 1.3 MB a day. Fatal errors with stack traces are much longer.

  • On a server you manage, add the file to logrotate or your platform’s equivalent, with a size or age limit.
  • On shared or managed hosting, the host usually rotates its own server logs. A debug log you created at a custom path is yours to manage.
  • After a fix, rename the file with the date, check that new lines have stopped and delete old copies on a schedule.

How do you keep the log file private?

Logs hold full server paths and stack traces. Depending on the code, they can also hold query strings, email addresses or other data a plugin passed to a function. Treat them as private files.

  1. Write outside the web root. A path above public_html or your document root cannot be fetched over HTTP. This is the safest option and works on every server.
  2. On Apache, block the default file. If the log must stay in wp-content, deny it in wp-content/.htaccess.
  3. On Nginx, block it in the server block. Nginx does not read .htaccess files, so the Apache rule does nothing there.
wp-content/.htaccess (Apache 2.4)
<Files "debug.log">
    Require all denied
</Files>
nginx server block
location = /wp-content/debug.log {
    deny all;
}

Check the result from outside: curl -s -o /dev/null -w '%{http_code}' https://example.com/wp-content/debug.log should return 403 or 404, never 200.

What does Site Health say about debug settings?

Open Tools, then Site Health. WordPress runs a debug mode test with two warnings worth knowing:

  • “Your site is set to log errors to a potentially public file.” It is critical when the PHP error log sits inside the WordPress folder, and recommended otherwise.
  • “Your site is set to display errors to site visitors.” It is critical, unless the site is marked as a development environment.

A private log path clears the first item down to a recommendation. Turning debugging off clears both.

When should you use SCRIPT_DEBUG and SAVEQUERIES?

Two more constants help with specific problems. Both belong on staging, not on a live site.

  • SCRIPT_DEBUG makes WordPress load the unminified “dev” versions of core CSS and JavaScript. Use it when a browser console error points into a minified core file you cannot read.
  • SAVEQUERIES stores every database query, with its time and the function that called it, in $wpdb->queries. The documentation warns that it slows the site.

We measured what SAVEQUERIES keeps. On the default homepage of our test site, a shutdown hook counted the stored records:

/srv/wp-logs/debug.log
[27-Nov-2026 09:36:26 UTC] Lab shutdown: 25 queries stored, 17137 bytes of query records

That is a fresh install with one post. A store with dozens of plugins runs many more queries per page, and each request holds the full list in memory. Turn it on, capture one slow page and turn it off.

Worked example: from log lines to a fix

Here is how we would close the two non-fatal lines from our test plugin. The same pattern applies to most warnings in real plugins and themes.

Steps

  1. Group and rank

    Run the grouping command above. The warning repeated on every load, so it goes first.

  2. Open the file and line

    Line 10 of lab-log-demo.php reads $settings['size'], a key the array never sets.

  3. Fix the cause, not the symptom

    Give the missing value a default instead of hiding the warning. For the deprecation on line 14, cast the value to a string before measuring it.

  4. Reload and watch the log

    Run tail -f on the log, load the same URL and confirm that no new line appears.

  5. Turn debugging off

    Follow the checklist in the next section.

lab-log-demo.php (fixed)
echo '<p>Size: ' . ( $settings['size'] ?? 'medium' ) . '</p>';

echo '<p>Title length: ' . strlen( (string) $title ) . '</p>';

If the warning comes from a third-party plugin, do not edit its files. Your change disappears at the next update. Report the line to the vendor with the PHP and WordPress versions, and check whether a newer release already fixes it.

How do you turn debugging off afterward?

  1. Set WP_DEBUG to false in wp-config.php, or remove the debug lines you added.
  2. Remove SAVEQUERIES and SCRIPT_DEBUG if you set them.
  3. Leave display_errors off at the PHP level, so a later change cannot print errors to visitors.
  4. Move or delete the debug log, and confirm the old URL returns 403 or 404.
  5. Recheck Site Health and note what you changed in your maintenance log.

Reading logs is easier when someone checks them every week, not only during an outage. Our WordPress maintenance checklist puts a log review next to updates and a timed restore test.

Limits: what this guide does not cover

  • We tested on WordPress Playground, which runs PHP compiled to WebAssembly with SQLite. Hosted sites run native PHP with MySQL or MariaDB. Log paths and formats on your host may differ.
  • We did not test the Apache and Nginx rules above on a live server. They come from the Apache 2.4 and Nginx documentation; check them with the curl command after you add them.
  • We did not re-run the fixed plugin code; the steps show how to confirm a fix on your own site.
  • Log rotation settings depend on your host or server setup, which we did not test.
  • Server error logs for PHP-FPM, Nginx and Apache vary by distribution and are only outlined here.