admin管理员组

文章数量:1122832

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 ?

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 ?

Share Improve this question asked Apr 4, 2024 at 10:31 FoysalFoysal 4451 gold badge5 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

You'll find error_log output

  • in WordPress's debug.log, under wp-content, if enabled
  • in your web server's error log file, e.g.
    • /var/log/httpd/error_log for Apache, or /var/log/apache2/error_log on Ubuntu
    • /var/log/nginx/default-error.log for nginx
  • or in your PHP FPM service's error log if you're running that instead

It generally won't get output in the web page, no. If you want that you can always echo instead, but be careful not to echo until you've reached the point that WordPress is going to emit the page template: as soon as you echo you prevent the server sending any more HTTP headers.

本文标签: debugError logging in wordpress