CodeIgniter Forums
Does log_message() log the line number? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Does log_message() log the line number? (/showthread.php?tid=62078)



Does log_message() log the line number? - eldan88 - 06-07-2015

Hey Guys,

I was just wondering. If I use the log_message function in CI 3 does it log the file name and the line number also? Thanks!


RE: Does log_message() log the line number? - mwhitney - 06-08-2015

The log_message function only writes the log level, the date/time, and the message you supply to it. The Exceptions class passes the file name and line number to log_message when logging exceptions, though.


RE: Does log_message() log the line number? - eldan88 - 06-15-2015

Do you mean PHP exceptions class or does codeigniter has its own exception class?


RE: Does log_message() log the line number? - mwhitney - 06-16-2015

CodeIgniter 3 has its own CI_Exceptions class which is used by the exception handler configured during CI's bootstrap process.


RE: Does log_message() log the line number? - eldan88 - 06-16-2015

What would be the difference if I use php native exceptions class or codeigniter exceptions class?


RE: Does log_message() log the line number? - mwhitney - 06-16-2015

The CI_Exceptions class is called by the function which CI registers as the exception-handler to log and (if enabled) display the exception. Since it is registered with PHP's native exception-handling mechanism, CI's exception-handler expects any exception thrown by your application to use (or extend) the native PHP Exception class.

So, CI_Exceptions is not an Exception (or an extension of Exception), it is simply a collection of methods which handle errors and exceptions, and a property which defines the error/warning levels used by CI.