Capturing Errors, Notices and store them all

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Capturing Errors, Notices and store them all

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
Last edited by John Cartwright on Mon Apr 04, 2005 10:16 pm, edited 1 time in total.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

might wanna look into Error_Log

edit: and the url Phenom posted is an even better resource ;)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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 ?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

honestly, i believe that this to be the only method... and all you would be doing is a simple include statement anyways :?
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

As far as I know the only other option you have is to write a filter (PERL?) for the actual log file.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Perl it will be, taking its ease of implementing filters ;)
I see CoderGoblin has took to liking Perl :D
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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..
Post Reply