Re: Debugging Log
| From: | Dan McCullough | Date: | Wed, 12 Jul 2006 18:26:06 +0000 |
| Subject: | Re: Debugging Log | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239356@lists.php.net to get a copy of this message | ||
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@kermodebear.org> 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@ioplex.com] 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