I'm trying to log errors from my codeigniter web app and I think the messages that get written to file are getting truncated. I say this because whenever the error is displayed on screen I get the file name where the error occurred whereas when I check the error logs it only says,
Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 24
Is there a way to have the error log return the file location of the error?
No, currently there isn't a built-in way to do this in CodeIgniter.
What you can do is to extend the core
CI_Log
class, override itswrite_log()
method and usedebug_backtrace()
to get the appropriate file name and prepend it to the message.