CodeIgniter Forums
Optional backtrace on logged SQL errors - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Optional backtrace on logged SQL errors (/showthread.php?tid=66359)



Optional backtrace on logged SQL errors - Pertti - 10-14-2016

I've searched this but couldn't find anything in requests, and this isn't available in CI 3.10.0, so here goes.

Would it make sense to add backtrace to SQL errors that are saved in log file?

For any bigger site / application, without any context it's hard to match breaking SQL query with actual code snippet.

Another solution, add optional SQL comment in the end of every query ( SELECT * FROM table -- PHP file [_LINE_] ) - that way it'll be part of the query and automatically gets saved, and it would be beneficial if let's say slow queries are saved by DB server, easy to see link between SQL statement and script that called it.


RE: Optional backtrace on logged SQL errors - Narf - 10-14-2016

Nothing is available in CI 3.10.0


RE: Optional backtrace on logged SQL errors - Pertti - 10-26-2016

Ha ha, I of course meant 3.1.0 Smile