Re: Debugging Log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wrote my own, very simple, very easy.  I think the code is in the
archive somewhere.  Otheres have written similar functions.

CODE +++++++++++++++++++++++++++++++++++++++

function logError ($logentry, $lgname) {
	// simple function to log errors to text/log file.
	$logfile = @fopen ($lgname, "a+");
     if (!$logfile) {
         echo ("\n\n ERROR: Failed to open $lgname\n\n");
     } else {
         fwrite ($logfile, "[".date ("D M d Y h:i:s")."] [$logentry]\n");
         fclose ($logfile);
     }
}

where you want to log

logError($username.' has successfully logged in.','account.log');

CODE +++++++++++++++++++++++++++++++++++++++

Lately I have been using the syslog from php.

On 7/12/06, KermodeBear <php@xxxxxxxxxxxxxxx> wrote:
http://pear.php.net/package/Log/ works well for me. Supports writing
messages to files, to a separate window via JavaScript, probably syslog as
well as a few others.

-----Original Message-----
From: Michael B Allen [mailto:mba2000@xxxxxxxxxx]
Sent: Wednesday, July 12, 2006 2:02 PM
To: php-general@xxxxxxxxxxxxx
Subject:  Debugging Log

What is the standard method of logging debug info? Should I just fopen
a file for append and write the message or is there a facility provided?

Mike

--
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux