Currently, if an exception is not caught, it is logged, displayed and execution is stopped; if an exception is caught, it is not logged and execution can continue. I’d like to be able to log exceptions which are caught.
For example, if a widget, which is not crucial part of the application, can’t display requested information for whatever reason, it can display the error in it’s box, log it and then let the application continue. Absence of an optional widget is better than an empty page with 404.
Temporary solution is to copy code from CApplication.handleException:
/** @param Exception $exception */
public function logException($exception)
{
$category = 'exception.' . get_class($exception);
if ($exception instanceof CHttpException)
$category .= '.' . $exception->statusCode;
// php <5.2 doesn't support string conversion auto-magically
$message = $exception->__toString();
if (isset($_SERVER['REQUEST_URI']))
$message .= ' REQUEST_URI=' . $_SERVER['REQUEST_URI'];
Yii::log($message, CLogger::LEVEL_ERROR, $category);
}