punk_runner Posted January 6, 2011 Share Posted January 6, 2011 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'); Quote Link to comment Share on other sites More sharing options...
unlishema.wolf Posted January 6, 2011 Share Posted January 6, 2011 okay first you want to check the simple stuff. is it in the correct dir. also can you post where the file is that you are outputting to the error report? cause that could also be the problem. Quote Link to comment Share on other sites More sharing options...
punk_runner Posted January 6, 2011 Author Share Posted January 6, 2011 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. Quote Link to comment Share on other sites More sharing options...
punk_runner Posted January 6, 2011 Author Share Posted January 6, 2011 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? Quote Link to comment Share on other sites More sharing options...
punk_runner Posted January 6, 2011 Author Share Posted January 6, 2011 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. Quote Link to comment Share on other sites More sharing options...
unlishema.wolf Posted January 6, 2011 Share Posted January 6, 2011 Glad I could help. It's the simplest of errors that get a lot of people. Like me lol. Quote Link to comment Share on other sites More sharing options...
punk_runner Posted January 6, 2011 Author Share Posted January 6, 2011 Yeah, I create my own MVC framework but crap like this messes with me. Do you know of a way to log fatal errors or is that just something you have to deal with is scripts killing themselves occasionally and you not knowing about it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.