Permalink
Browse files

Adjusting to use the exclude property instead of negation

  • Loading branch information...
1 parent 1589788 commit 760204dca2009c99378a5c56b4ff2d8999c26828 @acorncom committed Oct 1, 2012
Showing with 18 additions and 31 deletions.
  1. +18 −31 docs/guide/topics.logging.txt
@@ -89,43 +89,30 @@ category starts with `system.` are saved. The second route is
[CEmailLogRoute] which sends messages to the specified email addresses.
Only messages whose level is `error` or `warning` are sent.
-In a more advanced example (using a negating categories feature available in Yii 1.1.13+),
+In a more advanced example (using an exclude feature available in Yii 1.1.13+),
we can prevent certain categories from appearing in our logs:
~~~
[php]
-array(
- ......
- 'preload'=>array('log'),
- 'components'=>array(
- ......
- 'log'=>array(
- 'class'=>'CLogRouter',
- 'routes'=>array(
- array(
- 'class'=>'CFileLogRoute',
- 'levels'=>'trace, info',
- 'categories'=>'!system.CModule, system.*',
- // shows everything from system except CModule level logs
- ),
- array(
- 'class'=>'CEmailLogRoute',
- 'levels'=>'error, warning',
- 'categories'=>'!system.CModule.*'
- // Will show everything except any CModule logs
- 'emails'=>'admin@example.com',
- ),
- array(
- 'class'=>'CWebLogRoute',
- 'categories'=>'!system.db.ar.*, system.db.*',
- // shows all db level logs but nothing in the ar category
- ),
- ),
+ 'routes'=>array(
+ array(
+ 'class'=>'CFileLogRoute',
+ 'levels'=>'trace, info',
+ 'categories'=>'system.*',
+ 'exclude'=>'!system.CModule', // shows everything from system except CModule level logs
@mdomba

mdomba Oct 1, 2012

as exclude is used, there is no need for the ! char

@acorncom

acorncom Oct 1, 2012

Owner

Meant to get that the last time :-/

+ ),
+ array(
+ 'class'=>'CEmailLogRoute',
+ 'levels'=>'error, warning',
+ 'exclude'=>'system.CModule.*' // Will show everything except any CModule logs
+ 'emails'=>'admin@example.com',
+ ),
+ array(
+ 'class'=>'CWebLogRoute',
+ 'categories'=>'system.db.*',
+ 'exclude'=>'system.db.ar.*', // shows all db level logs but nothing in the ar category
),
- ),
-)
~~~
->Note: Negates must precede matches in order to work properly.
The following log routes are available in Yii:

0 comments on commit 760204d

Please sign in to comment.