0

I used the proper way to setup Wordpress debugging:

1.) Set up the wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true );
define('WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

2.) apache is the owner of wp-content folder

3.) apache has the proper SElinux rights:

drwxrwxr-x. 11 apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0  4096 Aug  5 19:32 wp-content

I found and followed all the previous Q&As and solutions here in this topic. But Wordpress still doesn't update debug.log in wp-content folder.

I'm working on Fedora28.

What could be the problem?

EDIT:

if (!function_exists('write_log')) {
    function write_log ( $log )  {
        if ( true === WP_DEBUG ) {
            if ( is_array( $log ) || is_object( $log ) ) {
                error_log( print_r( $log, true ) );
            } else {
                error_log( $log );
            }
        }
    }
}

I use the function above for get debugging info, like end of some function etc.

  • Permissions? Is the file writable? CHMOD 777. – WPZA Aug 5 '18 at 21:02
  • @WPZA as you can see at 3.) it has 775 and apache is the owner. – Geeocode Aug 5 '18 at 21:05
  • 1
    Well it will not show debug.log file unless there is something to show. How are you showing debug logs? Try creating the debug.log file manually and then in your theme's functions.php file put the code error_log('Debug log loading'); – Fayaz Aug 5 '18 at 21:27
  • 1
    I don't see any other problem that can be diagnosed from your given information. Another thing to note is: did you set all the constants before the require_once(ABSPATH . 'wp-settings.php'); line in wp-config.php file? Also, there can be two wp-config.php files, one on the same directory of wp installation and the other one in one directory up, make sure you are using the correct one. – Fayaz Aug 5 '18 at 22:09
  • 1
    @Geeocode If you have access to Apache, can you not just skip the debug.log stuff and go straight to superior standard PHP debugging practices, such as the actual PHP error log? XDebug even? – Tom J Nowell Aug 5 '18 at 23:54
-1

Based on this question:

You have @ini_set('display_errors', 0); - which will tell PHP (not WordPress) to stop displaying errors. WordPress requires errors to be turned on in order for it to pass them to the appropriate place. define('WP_DEBUG_DISPLAY', false); or define('WP_DEBUG', false); should take care of hiding them on the front end for you.

  • From the WP Codex: WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not. The default is 'true' which shows errors and warnings as they are generated. Setting this to false will hide all errors. This should be used in conjunction with WP_DEBUG_LOG so that errors can be reviewed later. Note: for WP_DEBUG_DISPLAY to do anything, WP_DEBUG must be enabled (true). Remember you can control WP_DEBUG_LOG independently. – Geeocode Aug 5 '18 at 21:38
  • @ini_set('display_errors', 0); line stops showing errors in the front end, but it doesn't stop producing them. So it doesn't affect the debug.log file. – Fayaz Aug 5 '18 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.