admin管理员组

文章数量:1122832

I can't find the right way to make it work. I tried many things, like putting this in wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', 'wp-content/themes/mytheme/mylog.log' ); // yeah, customized it a bit. It logs everything
ini_set('error_reporting', E_ERROR );

also tried to set it in the php.ini on various websites i manage. Not on managed hosting. Or at least not on the well known international ones. Can it be server side or syntax error, or not even possible what i want?

Thanks!

I can't find the right way to make it work. I tried many things, like putting this in wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', 'wp-content/themes/mytheme/mylog.log' ); // yeah, customized it a bit. It logs everything
ini_set('error_reporting', E_ERROR );

also tried to set it in the php.ini on various websites i manage. Not on managed hosting. Or at least not on the well known international ones. Can it be server side or syntax error, or not even possible what i want?

Thanks!

Share Improve this question edited Dec 30, 2021 at 22:55 Viktor Borítás asked Aug 26, 2020 at 17:56 Viktor BorításViktor Borítás 3042 silver badges11 bronze badges 2
  • maybe try including ini_set after wp_debug. Not sure whether this will work or not – Raashid Din Commented Sep 4, 2020 at 15:25
  • @RaashidDin Can you show with code, exactly how you mean it, please? – Viktor Borítás Commented Sep 5, 2020 at 13:11
Add a comment  | 

1 Answer 1

Reset to default 1

In short: this is the most detailed documentation on the topic (most likely)

Oh, and here is an amazing Php Error Level calculator to set up the php error mask binary code fast (if needed)

Based on this, i made my custom error reporting:

In functions.php

function error_report_log_customize(){
    error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING);
}
add_action('init','error_report_log_customize');

In wp-config.php

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', 'wp-content/themes/my-theme/my-logfile.log');
define('WP_DEBUG_DISPLAY', false);

Only thing I'm not 100% sure about which hook is the best for this. init seems working so far, but anyone with better insight, pls comment.

本文标签: phpHow to display only specific Error types in debuglog No noticeswarningsetc