• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Log file ERRORs but no URI, Controller, Model or View details

#1
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 
Reply

#2
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.
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!
Reply

#3
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.
Reply

#4
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.
Reply

#5
I'm glad to hear you fixed the problem! Smile
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!
Reply

#6
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.