Log file ERRORs but no URI, Controller, Model or View details |
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:
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.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
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.
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.
I'm glad to hear you fixed the problem!
![]()
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
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.
|
Welcome Guest, Not a member yet? Register Sign In |