You are here: Re: fwrite for log « PHP Programming Language « IT news, forums, messages
Re: fwrite for log

Posted by AnrDaemon on 10/04/84 12:00

Greetings, Hanoi.
In reply to Your message dated Monday, January 7, 2008, 11:36:10,

> I would like to have a php file that log informations sent by an image
> request.

> For logging, I use fwrite to write on a file.

For the logging purposes (considering there is not much of data sent to log)
I'm using this filter function:

function ob_debugfilter($str)
{
$str = date('Y-m-d H:i:s') . " {$str}\n";

if(defined('toolDebugFilterTarget') && toolDebugFilterTarget)
{
error_log($str, 3, toolDebugFilterTarget);
$str = NULL;
}

return $str;
}

To initialize it, You should define a constant toolDebugFilterTarget with the
path to Your logfile and start output buffering in Your code.
Don't forget to use ob_flush(); at each point of log output, itherwise all
Your log output from single run will be written in a single line.

I.e.

var_export($rc); @ob_flush();


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация