Jump to content

Help With Error Reporting


punk_runner

Recommended Posts

I want to log my errors to a log file but it isn't working. I get the error displayed on the screen but the file is not written to. The file permissions are set to 777 to make things easy. Error reporting is on for development only. Any advice on why I cannot write to the file? It's an apache server.

 

Is there a trick to getting the file path correct relative to my front controller? Also, if I use error_log to send the error to my email address, it works.

 

 

ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', true);
error_log("You messed up!", 3, '/var/www/vhosts/domain.com/httpdocs/framework/errors.txt');

 

Link to comment
Share on other sites

Hey wolf... they are in the same directory, www.domain.com/framework.

 

Eventually I will be changing where the error log is, to keep it out of public view, but for now I am just trying to get it working.

 

I've tried just setting it to 'errors.txt' since it is relative, but that didn't work either. File permissions are 777, CentOS Apache server.

Link to comment
Share on other sites

Actually, now that I think of it...

 

The error_reporting and error_log block of code is in my front controller, which is in /framework with the errors.txt file, BUT the error is being thrown on /framework/application/controllers/router.class.php... so how do I write that to the correct file, which is /framework/errors.txt?

Link to comment
Share on other sites

Okay, I got it working...

 

Number one, I had included my autoloader code before my error_log code, so the class that was causing an error was loading w/o any error_log directions... and I put the file as just '/errors.txt' as it is in the same directory as where my error_log code is.

 

Thanks for the input.

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.