404 Errors logging - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: 404 Errors logging (/showthread.php?tid=25733) |
404 Errors logging - El Forum - 12-22-2009 [eluser]danijelb[/eluser] Hello, I have a Errors_404 table in my db. I want to populate it with data about 404 errros, like IP of the user, time, and URL that caused 404. I made a model, but I can't use that model in 404 template. How should I do this? Thanks in advance. 404 Errors logging - El Forum - 12-22-2009 [eluser]n0xie[/eluser] You could just hijack the 404 function to load a controller which does have access to a model and then log it there. It can be easily done by extending the Router Class. 404 Errors logging - El Forum - 12-22-2009 [eluser]CroNiX[/eluser] http://maestric.com/doc/php/codeigniter_404 Thats a good custom 404 handler for ci. You could easily log using this since you have access to global CI object unlike the default 404. 404 Errors logging - El Forum - 12-22-2009 [eluser]Aken[/eluser] You can also use PHP directly in the 404 error file. You can't use the CI super variable, so any DB manipulation you'd have to write stand-alone. |