Log in file and send message for certain level

Hi !

I want to log all message types but I want to receive by mail the errors.

But it only logs the messages and doesnt send mails, or viceversa




array(

    ......

    'preload'=>array('log'),

    'components'=>array(

        ......

        'log'=>array(

            'class'=>'CLogRouter',

            'routes'=>array(

                array(

                    'class'=>'CFileLogRoute',

                    'levels'=>'info, warning, [b]error[/b]',

                    'categories'=>'system.*',

                ),

                array(

                    'class'=>'CEmailLogRoute',

                    'levels'=>'[b]error[/b]',

                    'emails'=>'admin@example.com',

                ),

            ),

        ),

    ),

)



Should work, at least with config similar to this (which I use myself)




array(

  'emails'=>array('...'),

  'subject'=>'...',

  'sentFrom'=>'...',

  'categories'=>'...',

),



/Tommy

There is an example in the guide for your exact case: http://www.yiiframework.com/doc/guide/1.1/en/topics.logging