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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
Sent: Wednesday, July 12, 2006 2:02 PM
To: php-general@lists.php.net
Subject: [PHP] 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

Reply via email to