Log PHP errors without showing data to visitors

So if you want to see custom errors, but don't want to let your visitors see it, you have a great option called error_log();. With Error log you can write to the default server error logs and see the errors on the NodeHost dashboard at any time. This works on all php versions since PHP 4.

Why do I need to use this?

If you want to monitor for user errors like failed login attempts, or even database connection errors, database query results that are finding nothing you can write custom messages to the logs for you to read.

How does this work?

When you have a place in your code where you want to send back a error update you can in your code by running the code below.

error_log("Error processing user login: IP, Username: test", 0);

Is there anything else you can do?

Why yes, you can also use this to send you email messages without needing to use the PHP mail system. Just run the function and get the email.

error_log("Error, user attack found, and user blocked.", 1, "admin@mysite.com");

You can read more on this function on the PHP documentation website. http://php.net/manual/en/function.error-log.php