Page 1 of 1

Capturing Errors, Notices and store them all

Posted: Mon Apr 04, 2005 10:09 pm
by anjanesh
Im looking for something like error_log() but instead of displaying the Notices, Warnings, Errors, it should all be directly written to the file/db.
I dont want to do
if (...)
error_log();
I want all errors, notices and warnings to be directly output to file/db without showing them on screen.
Also, I cannot change php.ini values (web host).
Any way ?
Thanks

Posted: Mon Apr 04, 2005 10:12 pm
by John Cartwright
Sounds like you havn't read

http://ca3.php.net/errorfunc, http://ca3.php.net/set_error_handler :wink:

and its helpful user comments

Posted: Mon Apr 04, 2005 10:14 pm
by infolock
might wanna look into Error_Log

edit: and the url Phenom posted is an even better resource ;)

Posted: Mon Apr 04, 2005 10:20 pm
by anjanesh
I've gone through these - it seems I've to include these in all my php scripts !
Thats not possible - the designer im working with has to idea abt PHP and may not be 100% ok if/when he edits a php script in Dreamweaver.
Is it not possible to have this all set up just once in .htaccess ?

Posted: Mon Apr 04, 2005 10:26 pm
by infolock
honestly, i believe that this to be the only method... and all you would be doing is a simple include statement anyways :?

Posted: Tue Apr 05, 2005 2:51 am
by CoderGoblin
As far as I know the only other option you have is to write a filter (PERL?) for the actual log file.

Posted: Tue Apr 05, 2005 4:08 am
by n00b Saibot
Perl it will be, taking its ease of implementing filters ;)
I see CoderGoblin has took to liking Perl :D

Posted: Tue Apr 05, 2005 4:32 am
by CoderGoblin
n00b Saibot wrote: I see CoderGoblin has took to liking Perl :D
Not necessarily, but PERL seems like the best thing for the job (only ever written a couple of filters using it (Excel import/export) but found it easy to learn, even if not to master). Others where I work are more "expert" and they already filter log files with it.

Posted: Tue Apr 05, 2005 6:01 am
by timvw
depends.... usually a combination of (pcr)(e)grep, sort, uniq, head, tail, cut are already sufficient ;)

but i don't deny perl has it charms too... still have to get used to all those operators that perl6 will have..