Title: Error logging
Last modified: April 4, 2024

---

# Error logging

 *  [mabufoysal](https://wordpress.org/support/users/mabufoysal/)
 * (@mabufoysal)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/error-logging-5/)
 * I set `define( 'WP_DEBUG', true );` & `define('WP_DEBUG_LOG', true);`. But `error_log('
   hello');` is not printing any thing. 
   What could be the issue ?

Viewing 1 replies (of 1 total)

 *  [Jomon Thomas Lobo](https://wordpress.org/support/users/jomonthomaslobo1/)
 * (@jomonthomaslobo1)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/error-logging-5/#post-17551032)
 * If you have set `WP_DEBUG` and `WP_DEBUG_LOG` to true in your WordPress `wp-config.
   php` file but you are not seeing the debug messages in the debug log file, there
   could be a few reasons for this behavior. Here are some steps you can take to
   troubleshoot and resolve the issue:
    1. **Check File Permissions**:
       Ensure that the directory where the debug log file
       is supposed to be written has the correct permissions that allow PHP to write
       to it. Typically, the file should be writable by the web server user (e.g., `
       www-data` on Apache).
    2. **Verify Debug Log Location**:
       WordPress debug logs are usually written to `
       wp-content/debug.log` unless you have explicitly defined a different location
       using the `WP_DEBUG_LOG` constant. Double-check the location to ensure you are
       looking at the correct file.
    3. **Verify `wp-config.php` Changes**:
       Double-check your `wp-config.php` file to
       ensure that the `WP_DEBUG` and `WP_DEBUG_LOG` constants are set correctly. Make
       sure there are no typos or syntax errors in the file.
    4. **Check Error Reporting Level**:
       Ensure that your PHP error reporting level 
       includes notices and warnings. If the errors you are trying to log are not severe
       enough, they may not appear in the debug log. You can set the error reporting
       level in your `php.ini` file or in your WordPress `wp-config.php` file using`
       error_reporting(E_ALL);`.
    5. **Check for Output Buffering**:
       Output buffering can sometimes interfere with
       debug output. Make sure that there are no functions or settings in your code
       that are buffering output, which could prevent the debug messages from being
       written to the log file.
    6. **Test with Simple Debug Message**:
       Instead of using `error_log('hello');`, 
       try using `error_log('hello', 0);` or `error_log('hello', 3, '/path/to/debug.
       log');` directly in your PHP code to see if any message gets logged. This can
       help isolate whether the issue is with the `error_log` function or with the 
       debug settings.
    7. **Review Server Error Logs**:
       Check your server’s error logs (e.g., Apache error
       log, PHP error log) for any relevant messages or errors that might indicate 
       why the debug messages are not being logged as expected.
 * By following these steps and checking these common issues, you should be able
   to diagnose why your `error_log` messages are not appearing in the WordPress 
   debug log file.

Viewing 1 replies (of 1 total)

The topic ‘Error logging’ is closed to new replies.

## Tags

 * [error_log](https://wordpress.org/support/topic-tag/error_log/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [Jomon Thomas Lobo](https://wordpress.org/support/users/jomonthomaslobo1/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/error-logging-5/#post-17551032)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
