CodeIgniter Forums
can I get a complete stacktrace? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: can I get a complete stacktrace? (/showthread.php?tid=14715)

can I get a complete stacktrace? - El Forum - 01-12-2009

Can anyone clue me into on how to get a complete stacktrace? I have subclassed CI_Exceptions, and am trying to get a stacktrace in an overridden log_error function. I have tried both debug_backtrace() and throwing an Exception in a try block, and doing a getTraceAsString() on the exception in the catch clause. It seems that the "juicy" bit is missing... :-S

from debug_backtrace():
at 0  /var/www/application/libraries/MY_Exceptions.php (line 13) -> getDebugBacktrace()
at 1  /var/www/system/codeigniter/Common.php (line 209) -> show_error()
at 2  /var/www/application/controllers/store.php (line 28) -> show_error()
at 3  unknown (line Unknown) -> edit()
at 4  /var/www/system/codeigniter/CodeIgniter.php (line 232) -> call_user_func_array()
at 5  /var/www/public_html/index.php (line 115) -> require_once()

* note: this has been formatted by me. the "unknown" part on line 3 is mine b/c the array does not containing that info.

from getTraceAsString():
#1 /var/www/system/codeigniter/Common.php(209): MY_Exceptions->show_error('An Error Was En...', 'record not foun...')
#2 /var/www/application/controllers/store.php(28): show_error('record not foun...')
#3 [internal function]: Store->edit('4')
#4 /var/www/system/codeigniter/CodeIgniter.php(232): call_user_func_array(Array, Array)
#5 /var/www/public_html/index.php(115): require_once('/var/www/port-8...')

I saw a user note in the PHP docs about call_user_func_array possibly messing with the stracktrace. Has anyone found a way around this?


EDIT: I am running this on Ubuntu 8.10 w/ PHP 5.2.6