![]() |
Codeigniter error logging similar to PHP/Apache general error logging - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Codeigniter error logging similar to PHP/Apache general error logging (/showthread.php?tid=20839) |
Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-23-2009 [eluser]sabya[/eluser] I have to do error_reporting(0) in my production server. This causes PHP's normal error log not to log anything. I have set "log_threshold" = 1 in the config.php. But the format that CI logs the errors are different. It will best, if I can get the normal PHP error logging. I want the errors to be logged in the same format as it does in normal PHP/Apache installation. That is: - 1. in the apache error_log 2. if there is an HTTP referrer present, log that. 3. no date based file separation. Log everything in a single file. Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-23-2009 [eluser]louis w[/eluser] You could extend the CI_Log class and customize the output. Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-23-2009 [eluser]sabya[/eluser] But I really don't want to write a logging handler myself. I just want to use the PHP's default handler. Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-23-2009 [eluser]louis w[/eluser] CI's logged uses a propitiatory (more novice friendly) output for their logs. If you want something else it's going to require customization. Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-23-2009 [eluser]Chad Fulton[/eluser] There are two solutions I see: 1. Disable CodeIgniter error handling system. I suspect that's not what you really want, however, since you're probably just interested in the log files. However, if you do want this, then you should comment out line 59 in system/codeigniter/CodeIgniter.php: Code: //set_error_handler('_exception_handler'); 2. Secondly, I suggest that rather than customizing CI_Log, you should customize CI_Exception class. In particular, you could override the log_exception function so that it called the native PHP function error_log, which would write to the apache error log as you want: Code: class MY_Exceptions extends CI_Exceptions { That will do what you want, by mimicking the PHP error logging format, and logging the error using the native PHP function. Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-30-2009 [eluser]sabya[/eluser] If I am logging through CodeIgniter's logger, I am missing this kind of error: - Code: [Fri Jul 31 04:25:26 2009] [error] [client 192.168.1.33] PHP Fatal error: Maximum execution time of 3 seconds exceeded in F:\\Test\\system\\application\\controllers\\test.php on line 24 How can I get these error messages also? Codeigniter error logging similar to PHP/Apache general error logging - El Forum - 07-31-2009 [eluser]thePiet[/eluser] [quote author="sabya" date="1248370209"]I have to do error_reporting(0) in my production server.[/quote] Why? |