“Debug Log” is good sort of tool for monitoring programs.
Trouble shooting is quite simple with Log Files. Log file can be used with analysis tools, it’s possible to get a good idea of where errors are coming from, how often errors return.
Here you can see a simple PHP script to trace PHP programs…
debugLog.php
………………….
function debugLog($log, $text)
{
$log_dir = dirname($log);
if( !file_exists($log_dir) or !is_dir($log_dir) or !is_writable($log_dir) )
return false;
$write_mode = ‘w’;
if( file_exists($log) && is_file($log) && is_writable($log) )
$write_mode = ‘a’;
if( !$handle = fopen($log, $write_mode) )
return false;
if( fwrite($handle, $text. “n”) == FALSE )
return false;
@fclose($handle);
}
Debugging Tools:
http://xdebug.org/
http://valgrind.org/
http://www.php-debugger.com/dbg/
http://pecl.php.net/package/apd
http://pear.php.net/package/Benchmark/
http://code.google.com/p/webgrind/