Support » Plugin: WP fail2ban » Please add constant to disable auth logging into error log when WP_DEBUG

  • Hey, thanks for all your work on this great plugin. The refactoring looks great.

    In openlog() you run this chunk of code:

    
        } elseif (defined('WP_DEBUG') && true === WP_DEBUG) {
            error_log('WPf2b: Opened syslog', 0);
        }
    

    And the matching section of syslog():

    
    } elseif (defined('WP_DEBUG') && true === WP_DEBUG) {
    	    error_log("WPf2b: Wrote to syslog: '{$msg}'", 0);
    

    The purpose as I understand it is to duplicate syslog entries into the PHP error log/WP error log when WP_DEBUG is enabled, I guess as a way to simplify debugging of this plugin.

    The thing is this causes a lot of unhelpful entries in our error log. We have an unusual setup WRT test site authentication and it generates a very distracting amount of noise in the logs.

    IMHO a constant that disables this duplication would be a big improvement. These messages aren’t really errors in most cases, but rather business as usual, so having them be inherently linked to WP_DEBUG is problematic. My goal is that these logs are totally empty unless there’s a problem.

    Here’s my edit to your plugin that solves it for me. openlog():

    
    		if (defined('WPF2B_LOG_TO_ERROR_LOG') && WPF2B_LOG_TO_ERROR_LOG)
    		    error_log('WPf2b: Opened syslog', 0);
    

    and syslog():

    
    		if (defined('WPF2B_LOG_TO_ERROR_LOG') && WPF2B_LOG_TO_ERROR_LOG)
    		    error_log("WPf2b: Wrote to syslog: '{$msg}'", 0);
    

    I beg of you: Please add this constant, or one with a different name obviously. I would be happy to set it to false if the default is true, or if you set it up so that the default was false I’d also be happy 🙂

    Thanks for your consideration, good luck with everything.

  • The topic ‘Please add constant to disable auth logging into error log when WP_DEBUG’ is closed to new replies.