Hello Friends,

I read some where “Quality is not a product.. it is a process 😉 ”

I think process is hard-work we do and product is final result we get.

But how we make our process to get a good product, as a LAMP developer I think track processes “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/

We can’t imagine processes without Log File 😉

2 Responses to PHP Debug Log – Trace Errors

  1. Anonymous says:

    Thank you for sharing superb informations. Your websiteis so cool.I’m impressed by the details that you’ve about this blog. It reveals how nicely someone perceives this subject. Bookmarked this site, will happen backfor extra articles. You, my pal, ROCK! I discovered this can be the info I already searched all over the place and couldn?t run into. That of a ideal website. I’m keen on this web website and your website is without a doubt one among my new favorite ones.I’m keen on this excellent website given possesses given me some sort of dedication to have success for most purpose, so thanks

  2. Anonymous says:

    I had been just browsing every now and then but happened to be you just read this post. I have to admit that we are from the hand of luck today if not getting this excellent post you just read wouldn’t are actually achievable personally, at the very least. Really appreciate your content.

Leave a Reply