Debug Log Rotation
WP Plugin - Compresses the debug.log file if it exceeds a certain size and stores it in the wp-content/debug-log-archive folder, keeping a maximum of 10 archived files.
by jesweb.dev · github.com/jes-wd/debug-log-rotation · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/jes-wd/debug-log-rotation/archive/refs/heads/main.zipDebug Log Rotation is a WordPress plugin that automatically compresses and rotates the debug.log file generated by WordPress when debugging is enabled. This helps optimize WordPress performance and disk space usage by keeping the debug log file size under control.
Features
- Automatically compresses the
debug.logfile when it exceeds a specified size threshold. - Stores the compressed debug log files in the
wp-content/debug-log-archivefolder. - Maintains a maximum number of archived debug log files to prevent disk space overuse.
- Runs in the background using WordPress cron jobs, ensuring minimal impact on website performance.
- Easy to install and configure, with no additional setup required.
Installation
- Download the latest release of the Debug Log Rotation plugin from the GitHub repository.
- Extract the downloaded ZIP file.
- Upload the
debug-log-rotationfolder to the/wp-content/plugins/directory of your WordPress installation. - Activate the plugin through the 'Plugins' menu in WordPress.
- The plugin will automatically start compressing and rotating the debug log file.
Configuration
By default, the plugin compresses the debug.log file when it exceeds 5MB in size and keeps a maximum of 10 archived files. These settings can be easily customized by modifying the corresponding constants in the plugin file:
JDLR_MAX_DEBUG_LOG_SIZE: Sets the maximum file size threshold in bytes (default: 5MB).JDLR_MAX_ARCHIVED_FILES: Sets the maximum number of archived files to keep (default: 10).JDLR_CHECK_INTERVAL: Sets the interval for checking the debug log file size (default: 3600 seconds, i.e., every hour).
To modify these settings, open the debug-log-rotation.php file in a text editor and change the values of the corresponding constants.
Frequently Asked Questions
How does the plugin compress and rotate the debug log file?
The plugin periodically checks the size of the debug.log file. When the file size exceeds the specified threshold (default: 5MB), the plugin compresses the file using gzip compression and stores it in the wp-content/debug-log-archive folder with a unique filename. The original debug.log file is then deleted to free up space.
How often does the plugin check the debug log file size?
By default, the plugin checks the debug log file size every hour using WordPress cron jobs. You can modify the check interval by changing the value of the JDLR_CHECK_INTERVAL constant in the plugin file.
Contributing
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on the GitHub repository.
License
Debug Log Rotation is licensed under the GNU General Public License v2.0 or later.
Credits
Debug Log Rotation is developed and maintained by Jesweb.dev.
This README.md file provides an overview of the Debug Log Rotation plugin, including its features, installation instructions, configuration options, frequently asked questions, and information about contributing and licensing. It's written in Markdown format and can be included in the GitHub repository for the plugin.
Feel free to customize the content based on your specific plugin details and requirements.