WordPress can do logging! Check out the WordPress debugging page here https://codex.wordpress.org/Debugging_in_WordPress
I typically like to set my local development websites up to log errors in a debug file, rather than to have them output on the screen.
Head over to to your wp_config file and scroll to the bottom where it defines WP_DEBUG.
This is what my typical setup looks like:
define('WP_DEBUG', true); // To enable debugging. Leave things just like this to output errors, warnings, notices to the screen:
define( 'WP_DEBUG_LOG', true ); // To turn on logging
define( 'WP_DEBUG_DISPLAY', false ); // To prevent output of errors, warnings, notices to the screen (which I personally find SUPER annoying):
With those settings, WordPress will now log errors, warnings, and notices to a
debug.log file located in
Log files in production environments are security threats so IF you decide to have logging on a production environment, it would be a good idea to set your .htaccess file to deny access to the log file (or similarly use a security plugin to block it). That way you still get your logs, but don't have to worry about hackers getting all that info as well.