Skip to content

Knowledgebase

Enabling a temporary WordPress debug log safely

wordpress, performance

A temporary debug log can capture the PHP error behind a failed WordPress request without intentionally displaying those details to visitors. Enable it for a controlled diagnostic window, protect the log and remove the temporary configuration when the investigation is complete.

01 Prepare the correct configuration file

Confirm the intended WordPress installation and back up its wp-config.php. Check whether debug constants already exist; modify the existing definitions rather than adding contradictory duplicates.

Choose a writable log location outside the public document root where your service permits it. Replace the example path below with a real private path approved for the account. Do not assume the placeholder exists or create a publicly downloadable log by accident.

02 Enable logging for the test

  1. Use an authorised file-management method and place the settings before WordPress's stop-editing comment and bootstrap include.
  2. Set the debug and logging values deliberately, keeping display disabled:
Code or configuration example
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', '/private/path/wordpress-debug.log');
define('WP_DEBUG_DISPLAY', false);
  1. Save the file without changing unrelated credentials or configuration.
  2. Reproduce the failing task once and record the exact time.
  3. Read the new log entries and confirm that the diagnostic information is not visible in the public response.

03 Interpret and protect the output

A log can contain account paths, request data or information written by plugins. Share only a sanitised relevant excerpt through the approved support channel. Do not publish the entire file or include passwords and tokens from request payloads.

Warnings and deprecation notices are not automatically the cause of a fatal failure. Match the entry to the test time and symptom, and inspect the component and stack trace where available.

04 Finish the diagnostic window

Restore the intended production debug configuration, normally disabling temporary debug logging, and verify the site still works. Securely retain only the evidence needed for the support case and remove or rotate the temporary log according to your handling policy.

Leaving verbose logging active can increase storage use and expose sensitive details if permissions or web-server rules are wrong. Setting display false is useful, but verify the actual server response because other PHP configuration or code can still print information.

05 Example: check the edited debug configuration before reproducing the error

After carefully editing the existing debug constants in the correct wp-config.php, check its PHP syntax through an authorised shell where available. This command parses the file without running WordPress or displaying the configuration contents.

Command example
php -l /home/ACCOUNT/sites/example.com/wp-config.php

Use the appropriate PHP executable for the site. A successful syntax check does not prove that the private log path is writable or that no other code prints errors. Reproduce the original failing action once, note the time, inspect only the relevant new log entries, and verify the public response remains free of diagnostic details.

Expected result: The configuration remains syntactically valid and the expected event appears in the protected log. Restore the intended production debug settings after the diagnostic window, retaining only the sanitised evidence required to resolve the issue.

Why is the temporary WordPress debug log empty?

Check the chosen path, permissions and configuration placement. An early server-level failure may need the hosting PHP error log instead. Avoid setting directories to world-writable or pasting a whole configuration file into a ticket. Ask us to confirm the appropriate private logging route for the service when the path or access scope is unclear.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support

Powered by WHMCompleteSolution