No route CHttpException

Hello!

I have an application that route logs via email, with error and warning levels.

My issue is that I don’t want to receive the CHttpException (error 404, 403, etc) throw by Yii.

Is there a way to filter CHttpException to this route?

Thanks!

Not tested but maybe can work like this:

Create and install your own LogFilter and override the method filter().




class MyLogFilter extends CLogFilter {

 

  public function filter(&$logs)

        {

              

            $mylogs = array()

              foreach($logs as $log) 

              {  

                //var_dump($log);

                //$log[2] should be the category 


                   if(strpos($log[2],'exception.CHttpException') === false)

                     $mylogs[]=$log;

        

  

              }

             $logs = $mylogs;

             parent::filter($logs);   

                     

        }



http://www.yiiframework.com/doc/guide/1.1/en/topics.logging




'log' => [

    'class'=>'CLogRouter',

    'routes' => [

        [

            'class' => 'CFileLogRoute',

            'levels' => 'error, warning',

            'except' => 'exception.CHttpException.404',

        ],

    ],

],