Log error and other information
Moderator: General Moderators
Log error and other information
I need to know what is going in different stages of execution process. I am thinking to echo/print statements in in many different PHP files and write them into some text file. Is there a log file that I can customize it for my needs or is there a way to write to a text file? Please note that I have multiple PHP/HTML files that I need to trace and print message/status to a text file. Your suggestion is appreciated in advance.
Re: Log error and other information
I would create a function in a seperate php file to write to a text file and take input kinda of like this...
then you can call that function with whatever you want to input into it like this...
and viola you have a text file on your server that contains whatever you want to put into it.
Code: Select all
function logerror($input)
{
$myFile = "errorfile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $input \n;
fwrite($fh, $stringData);
fclose($fh);
}
Code: Select all
$error1 = logerror(put your text here that you want to be input to that text file);