开发者

How to handle error log in framework

This is sample code t开发者_如何学JAVAo catch error in PHP.

<?php
// Error handler function.
function customError($errno, $errstr)
{
    echo "<b>Error:</b> [$errno] $errstr";
}

// Set error handler.
set_error_handler('customError');

// Trigger error.
echo($test);
?> 

I am using frameworks. i dont know how to log errors. I tried by giving function customError($errno, $errstr) in modal and I called from controller it doesn't work for me. How to handle error in frameworks?


The best approach is to throw exception. Inside your main execution loop catch exceptions and output them into log file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜