Skip to content

Improve the Logger functionality to reduce the size of the log file #7368

@girlie

Description

@girlie

Describe the bug
Certain Logger functions have the potential to generate a large amount of output into the wp-rocket-debug.log.html file, which becomes difficult (if not impossible) to open, read, search, etc., and can even take some sites down. (This is why I filed this as a bug rather than an enhancement.)

For example, this code for logging the replacement of CSS images with the lazyloaded version writes the entire HTML output from the page being processed into the log:

So it's much like having every cache file all merged together in a single file, and then some. (I have one case where each cache file is 1.5MB or larger, and with approximately 800 URLs to be processed, that would mean a minimum size of 1.2GB for the log file by the time it's all done.)

Other possibilities for further refinement/reconsideration:

  • DEBUG: Found XX <link> tags
  • NOTICE: Skipped URL
  • NOTICE: Extracted Content

It seems most of us probably use this file to diagnose wpr not cached issues; so as listed by Camila, we're mostly looking at the logger entries for:

  • donotcachepage set
  • buffer content under 255
  • excluded or mandatory cookie
  • config file not found

Most of the above was extracted from this Slack thread: https://group-onecom.slack.com/archives/C08EFUD9XLJ/p1743007363049459

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions