| 开发者 | e3pr0m |
|---|---|
| 更新时间 | 2026年11月30日 19:55 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.2 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
debug.log and your PHP error log, sorts the messages by how serious they are, explains each one in a plain sentence and says whether it comes from a plugin, a theme or WordPress itself. It also lets an administrator turn debug logging on and off from a panel, without editing any file by hand.
You find it in Tools → ErrorLight. Only administrators can use it. On a multisite network only the super administrator can, and the button that edits wp-config.php is not offered there: the file is shared by every site, so the panel shows the lines to set by hand.
Logs are private data, so the button is careful. ErrorLight turns logging on from the panel only after a test has confirmed that the log folder cannot be opened from a web address, whatever your server. If it cannot confirm it, wp-config.php is not changed: the panel hides the button, explains why, gives you a message for your hosting provider and shows the lines you can add by hand. See the FAQ.
What you can do
wp-config.php, checks the result and restores the original automatically if anything goes wrong.wp-content/debug.log, the file name everyone tries first. ErrorLight shows where it is, tells you whether it can be downloaded and suggests how to remove it (it never deletes files outside its own folder).wp-config.php. WP_DEBUG_DISPLAY is always kept off, so errors are never shown to your visitors.wp-config.php.wp_mail():
e3p_errorlight_settings, with your turn-off or reminder choice. It is created when you turn logging on from the panel and removed when you turn it off. Up to two scheduled WP-Cron events go with it.wp-config.php (when you press the button, with a confirmation, and when the automatic turn-off you chose runs: only the three debug constants, written directly into the file, with no temporary or backup copy), and a folder named errorlight inside your uploads folder (found with wp_upload_dir()), with the log folder and its protection files, a lock file and short-lived test files that are deleted right away. The folder is created when you try to turn logging on or run the check, even if logging is then not turned on. ErrorLight never writes to or deletes any other file: the old wp-content/debug.log is only read, and you remove it yourself.errorlight folder in uploads and the logs in it, is removed when you delete the plugin. The lines it added to wp-config.php stay, so download your logs and turn logging off first: if logging is still on, WordPress keeps debugging without a log file until you set WP_DEBUG and WP_DEBUG_LOG to false there.
errorlight folder to wp-content/plugins/, or install it from the Plugins screen.There are three possible reasons, and the panel tells you which one applies:
wp-config.php are not written in the standard way (for example, they are inside an if) or the file cannot be written. ErrorLight changes nothing and shows how the lines should be written, so you can add them by hand.wp-config.php belongs to every site.Logs can contain sensitive data, so ErrorLight turns logging on only after it has confirmed that the log folder cannot be opened from a web address, on any server. Before changing anything, ErrorLight requests a test file from that folder:
wp-config.php is not changed and the panel warns you;wp-config.php is not changed and the panel says what it saw.uploads/errorlight folder (on Nginx, a location rule that denies it). The panel has a message you can copy for them. Then press "Check again": if the check succeeds, the button comes back. You can also add the debug lines to wp-config.php by hand: the panel shows them. In that case WordPress saves the log in wp-content/debug.log, which may be downloadable, so turn logging off as soon as you are done.
It checks that the new version is valid PHP before writing it, writes it directly into wp-config.php (no temporary or backup copy is created anywhere), then reads the file back and restores the original automatically if anything is wrong, and checks that the restore worked. Two requests at the same time cannot overwrite each other. Only the three debug constants are touched, and every line ErrorLight changes or adds is marked with an ErrorLight comment.
Yes, in a limited and safe way. On a network only the super administrator can open ErrorLight (from any site of the network), and reading, downloading and e-mailing the log work as usual. The button that turns logging on and off is not offered: wp-config.php is shared by every site in the network, so a change made from one site would affect all of them. The panel shows the lines to set by hand instead, and the automatic turn-off is not available. ErrorLight has no network admin screen.
WP_DEBUG and WP_DEBUG_LOG are set to false and the lines ErrorLight added are removed. ErrorLight does not restore the value they had before. If debug logging was already on before you used ErrorLight, the panel tells you.
It uses WP-Cron, which runs when someone visits the site. ErrorLight also checks every time someone opens an admin screen. If the turn-off fails, logging stays on, the panel says so and the administrator receives one e-mail.
The log folder is inside your uploads folder, with a secret name and rules for Apache and IIS that block access from the web. Some servers (Nginx, for example) ignore those rules, which is why the button relies on the test described above and not on the rules alone. You can run the same test at any time with the check button. The old wp-content/debug.log is checked too: if it can be downloaded, the panel says so and explains how to remove it.
A very large log would make the page slow or run out of memory, so ErrorLight reads the end of the file, up to 2 MB at a time (less when PHP has little free memory). Pick a period to look at older days. To get the whole file, download it (up to 50 MB; for larger logs you get the latest part).
ErrorLight shows the dates written in the log, which PHP usually writes in UTC. It converts to your site time only where the log says it uses UTC.