Tuesday 14 August 2018

How to Create an Error Log in PHP

Learn the function to write a custom error log in PHP.
It was only recently that I realized you could send custom error logs to whatever file you want. I just create a logs directory and told PHP to write a message to that location when the script was hit. In the below code, the message “Error message” will get sent to error.log.
<?php

error_log("Error message\n", 3, "/Users/tania/logs/error.log");

0 comments:

Post a Comment