O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Info: Message routing occurs at the end of the current request cycle when the<br />
onEndRequest event is raised. To explicitly terminate the processing of the current<br />
request, call CApplication::end() instead of die() or exit(), because CApplication::end()<br />
will raise the onEndRequest event so that the messages can be properly logged.<br />
Message Filtering<br />
As we mentioned, messages can be filtered according to their levels and categories before<br />
they are sent long a log route. This is <strong>do</strong>ne by setting the levels and categories properties<br />
of the corresponding log route. Multiple levels or categories should be concatenated by<br />
commas.<br />
Because message categories are in the format of xxx.yyy.zzz, we may treat them as a<br />
category hierarchy. In particular, we say xxx is the parent of xxx.yyy which is the parent of<br />
xxx.yyy.zzz. We can then usexxx.* to represent category xxx and all its child and<br />
grandchild categories.<br />
Logging Context Information<br />
Starting from version 1.0.6, we can specify to log additional context information, such as<br />
PHP predefined variables (e.g. $_GET, $_SERVER), session ID, user name, etc. This is<br />
accomplished by specifying the CLogRoute::filter property of a log route to be a suitable<br />
log filter.<br />
The framework comes with the convenient CLogFilter that may be used as the needed log<br />
filter in most cases. By default, CLogFilter will log a message with variables like $_GET,<br />
$_SERVER which often contains valuable system context information. CLogFilter can also<br />
be configured to prefix each logged message with session ID, username, etc., which may<br />
greatly simplifying the global search when we are checking the numerous logged<br />
messages.<br />
The following configuration shows how to enable logging context information. Note that<br />
each log route may have its own log filter. And by default, a log route <strong>do</strong>es not have a log<br />
filter.