CodeIgniter Forums
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/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: Log file ERRORs but no URI, Controller, Model or View details (/thread-1553.html)



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
 
 Undeclared variableAs_I_Mature Invalid query
 
 SELECT idtitlexrlmemo 
  FROM wisdom ORDER BY title  
  LIMIT As_I_Mature
11.html 

ERROR 
12:03:59 --> SeverityWarning --> ini_set(): 
 
 A session is active
 
 You cannot change the session module's ini settings at this time 
  /home/is/where/the/heart/is/ci3/CodeIgniter-3-0rc3/system/libraries/Session/Session.php 317 



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
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\application\controllers\home.php 10

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
 
Undeclared variableAs_I_Mature Invalid query
 
SELECT idtitlexrlmemo 
 FROM wisdom ORDER BY title  
 LIMIT As_I_Mature
11.html 

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 --> SeverityWarning --> ini_set(): 
 
A session is active
 
You cannot change the session module's ini settings at this time 
 /my/system/folder/ci3/CodeIgniter-3-0rc3/system/libraries/Session/Session.php 317 

 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! Smile


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.