Laravel framework usually comes with an error page, if the configuration file Debug=true, will expand the error debugging interface, through the stack tracking can be detailed to see the program's execution process, and error prompts and can accurately locate the error line, debugging is very convenient. In a production environment to turn off Debug=false, the error response displays a simple error page; The problem is that a custom error is needed in the actual project and the administrator can see the error log exactly:
Laravel Easy to handle!
Custom error:
It is also convenient if you want to customize a global error page: An error handler is defined in the app/global.php file in the root directory:
App::error (function (Exception $exception, $code) {log::error ($exception); return Response::make (' server seems to have a bit of a problem oh! ', 404);});
This function is automatically called when an exception or error is encountered, and the error log is logged, and the front end is given a 404 content prompt response.
Here the response content can be arbitrary, it is best to specify to the error page, you can also specify to the custom controller, or directly output custom error prompt!
App::error (function (Exception $exception, $code) {log::error ($exception); Return Response::view (' error ', 404);});
Say the error log; Laravel use of the famous monolog, log records when the log file is cut into multiple files, preferably in days to generate, easy to check the wrong, specify the error log path
Log:: Usefiles (Storage_path (). '/logs/laravel.log ' );
The above describes the Laravel custom error page and error log processing, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.