Log file ERRORs but no URI, Controller, Model or View details - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: Log file ERRORs but no URI, Controller, Model or View details (/showthread.php?tid=1553) |
Log file ERRORs but no URI, Controller, Model or View details - John_Betong - 03-20-2015 Is it possible to log the URI, etc to the log file because it is not easy to track the source of some errors. Please note I know how to fix the errors but cannot find where the script that generates the errors is located. Typical extract from log file: PHP Code: ERROR - 09:33:46 --> Query error: RE: Log file ERRORs but no URI, Controller, Model or View details - RobertSF - 03-20-2015 Hi John, When I review my log files, I see that when errors come from the CI system itself, there is a previous log line with the same time stamp that points out where the error comes from in my own files. Like this. Code: ERROR - 2015-02-18 12:32:05 --> Severity: Warning --> Cannot modify header information - headers already sent by (output started at C:\Users\admin\Apache\htdocs\ci\index.php:178) C:\Users\admin\Apache\htdocs\ci\system\libraries\Session.php 688 In any case, do you have PHP's error reporting turned on to E_ALL? That's what I use instead of CI's error logs. RE: Log file ERRORs but no URI, Controller, Model or View details - gadelat - 03-23-2015 Increase log_treshold in your config. But yeah, this is good idea anyway. @RobertSF: That applies when PHP error is triggered, OP is having problem with SQL Query which is not PHP error. RE: Log file ERRORs but no URI, Controller, Model or View details - John_Betong - 03-23-2015 I managed to fix this errors thanks to gadelet and RobertSF: First error: PHP Code: ERROR - 09:33:46 --> Query error: The Database error was in ./config/routes.php. Before upgrading to CI RC3, /(:any) was used extensively. Unfortunately I changed /(:any) to the incorrect /(:+) instead of /(.+) which resulted in incorrect URI parameters being passed to the Controller and Model. Second error: PHP Code: ERROR - 12:03:59 --> Severity: Warning --> ini_set(): I amended and added the following lines to: /my/system/folder/ci3/CodeIgniter-3-0rc3/system/libraries/Session/Session.php 317 // Line: 143 - ORIGINAL SCRIPT // session_start(); // John_Betong added to try and see where the session_start() was already started if( ! isset($_SESSION) ): session_start(); log_message('error', 'Session ALREADY STARTED: ' .$this->uri->uri_string()); else: session_start(); endif; This error has not occurred since so it looks as though the error could have been cleared with fixing the first error. RE: Log file ERRORs but no URI, Controller, Model or View details - RobertSF - 03-24-2015 I'm glad to hear you fixed the problem! RE: Log file ERRORs but no URI, Controller, Model or View details - CroNiX - 03-24-2015 You should really extend the Session class rather than alter it in /system. Now whenever you upgrade, which should be often since it's an RC and not a final version, you have to check to see if your change got overwritten (most likely) and add it back in. |