Re: Adding a log file
| From: | John W. Holmes | Date: | Sat, 08 Nov 2003 03:21:19 +0000 |
| Subject: | Re: Adding a log file | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-168935@lists.php.net to get a copy of this message | ||
Erik Osterman wrote:
Consider using this....
//
// STDERR logging function
//
function warn( $msg, $die = 0 )
{
$fp = fopen("php://stderr", 'w') or die("Failed to open STDERR");
fwrite($fp, "[".strftime("%Y-%m-%d %T")."] $msg\n") or die("Failed to write to stderr");
fclose($fp);
if($die)
die($msg);
}
There is also the error_log() and syslog() functions.
http://us2.php.net/error_log
http://us2.php.net/syslog
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com