The debug log records what Powered Cache does in the background: preload requests, cache purges, cleanups, database optimization and, with Premium, Critical CSS and Remove Unused CSS jobs. It is off by default. Turn it on for a short time when something does not work as expected, then turn it off again.
Available in: Powered Cache (free)
Where to find it: wp-config.php (there is no setting in the admin)
Turn on the debug log #
- Open
wp-config.phpin the root folder of your WordPress site. - Add these lines above the line
/* That's all, stop editing! */. Use a path on your server that WordPress can write to, ideally outside the public web folder.
define( 'POWERED_CACHE_ENABLE_LOG', true );
define( 'POWERED_CACHE_LOG_FILE', '/home/example/logs/powered-cache.log' );
- Save the file and reproduce the problem, for example by starting a preload.
- Open the log file and read the new lines.
Where the log is written #
- With
POWERED_CACHE_LOG_FILE: Powered Cache appends each line to that file. This is the recommended setup, because the file contains only Powered Cache lines. - Without it: lines go to the PHP error log. When
WP_DEBUGandWP_DEBUG_LOGare both on, WordPress writes that log towp-content/debug.log, mixed with other PHP messages. Otherwise the server’s PHP error log is used. Your host can tell you where that is.
A debug.log file inside wp-content can often be opened by anyone in a browser. It contains page addresses and visitor IP addresses, so prefer a file outside the public web folder.
Read the log #
Each line has the same four parts:
08:14:03 31852 203.0.113.10 Processing..: https://example.com/sample-page/
- Time in UTC, without a date.
- Process ID of the PHP process. Lines with the same number belong to the same request, which helps when several jobs run at once.
- IP address of the request: the
X-Forwarded-Forheader when present, otherwise the connecting address. Background jobs often show your server’s own address. - Message.
What is logged #
The log covers background work and admin actions, not every page view. Typical lines:
| Area | Example messages |
|---|---|
| Preloading | Processing..: URL, Preload request for URL returned 503., Preload paused: server load too high or spike detected (…), Full preload … step …, Daily full preload requested., Manual preload requested from the admin bar., Could not install the preload URL table. |
| Preload settings | Enable Preloader - Settings toggle, Cancel preload process - Settings toggle, Refresh Preloader - Source settings changed |
| Cache purging | Call: …, delete_page_cache - URL, Async cache purge has been completed!, Cleanup via cron: path |
| Background jobs | Dropping … item after 5 retries. (a job failed too often and was given up) |
| Database | Optimizing..., Optimization completed... |
| Integrations | Cloudflare API Error: …, Sucuri cache purge failed: … |
| Updates | Upgraded to version 4.0 |
| Critical CSS and Remove Unused CSS (Premium) | Creating critical: URL, Creating UCSS: URL, Doing Critical Request..., Critical Error: …, Invalid license key for Critical CSS, Critical CSS task skipped because the service is unavailable or disabled. |
| Media (Premium) | Add image dimensions: src, LCP image preload injected: … |
For help with specific problems, see Preload Not Running and CSS Generation Issues.
Log only your own requests #
On a busy site, the log fills up fast. Add define( 'POWERED_CACHE_LOG_IP', '203.0.113.10' ); with your own IP address to log only requests from that address. Keep in mind:
- The value must match the logged IP exactly. Behind a proxy or CDN,
X-Forwarded-Forcan contain several addresses. Copy the value from an existing log line. - Background jobs such as preloading and async purging usually run in requests that do not come from your IP, so their lines are skipped. Do not use this constant when you debug background jobs.
What else changes while the log is on #
- Miss reason header. Every page that is not served from the cache sends the
X-Powered-Cache-Miss-Reasonheader to every visitor. It is useful for debugging, see Check Cache Status, but anyone can read it. To get only the header, usePOWERED_CACHE_MISS_REASONinstead. - The file keeps growing. Powered Cache does not rotate or shorten the log. Delete or empty it when you are done.
- Personal data. The log stores visitor IP addresses. Keep it only as long as you need it.
Turn off the debug log #
Remove the POWERED_CACHE_ENABLE_LOG line, or set it to false. Remove POWERED_CACHE_LOG_FILE and POWERED_CACHE_LOG_IP too, then delete the log file. All logging constants are listed in wp-config Constants.
For developers #
Logging uses PHP’s error_log(). The powered_cache_log_message filter changes the line before it is written, powered_cache_log_message_type sets the error_log() message type (default 0, or 3 when POWERED_CACHE_LOG_FILE is defined) and powered_cache_log_destination sets the destination. Your own code can write to the same log with \PoweredCache\Utils\log( 'message' ). See the Hooks Reference.