Original Author's blog: ieqi.net
========================================================== ========================================================== ================================
Exceptions and logs
In applications, we always encounter various problems and exceptions. At this time, it is very important to record the status when exceptions occur, so exceptions and logs are naturally related.
The exception and log configuration is in the application/config/error. php file.
The file contains four configuration items:
'Ignore' => array (), 'detail' => true, 'log' => false, 'logger '=> function ($ exception) {log :: exception ($ exception );},
Where the ignore key points to the array set the PHP error level that needs to be ignored, about the error level, you can refer to here (http://php.net/manual/en/function.error-reporting.php ).
The detail item indicates whether to display detailed error information. Generally, this item should be set to true during development and disabled in production.
If the log item is set to true, when an exception occurs, the Framework executes the anonymous function configured for the logger item. This provides great convenience for processing error logs. You can even set email notifications in anonymous functions. By default, log is enabled, the system will write error logs to log files under storage/logs, which are separated by days after installation.
In addition, if you want to write some information into the log file in the program, you can directly call the following method:
Log: Write ('info', 'this is just an informational message! '); // You can also write a simpler log: Info ('this is just an informational message! ');