Jump to content

error reporting


SirChick

Recommended Posts

I am creating an advanced error reporting system for handy de-bugging with errors to do with logic for the most part.

 

What i got is this sort of idea say the main script had at certain parts of the script:

 

Mainfile.php:

44: <?php
45:
46: include("errorcoresystecheck.php");
47: //code stuff
48: include("errorcoresystecheck.php");
49: //code stuff
50: include("errorcoresystecheck.php");
51: ?>

 

 

 

What i want to do is say an error happens in the error system checker.... this would spell big problems so im putting error logging on the error checking system. So what i wanted to do was say the error occurred on the 2nd of those 3 includes...

firstly i can get what script it happened on which is mainfile.php using dirname(strtolower($_SERVER['PHP_SELF'])).

 

But is it physically possible to also get what line the user is on when this "insert" is taking place on the PHP_SELF page not the include file..so in this case it would show mainfile.php on line 48. as a log?

 

Link to comment
Share on other sites

You can also do this, which is a bit less sophisticated, but still...

<?php
set_error_handler("my_error_handler");

function my_error_handler($errno,$errMsg,$errFile,$errLine,$errContext)
{
   echo "$errMsg occured in $errFile on line $errLine<br>";
}
trigger_error("this is a warning",E_USER_WARNING);
trigger_error("this is a total error",E_USER_ERROR);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.