O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
array(<br />
......<br />
'preload'=>array('log'),<br />
'components'=>array(<br />
......<br />
'log'=>array(<br />
'class'=>'CLogRouter',<br />
'routes'=>array(<br />
array(<br />
'class'=>'CFileLogRoute',<br />
'levels'=>'error',<br />
'filter'=>'CLogFilter',<br />
),<br />
...other log routes...<br />
),<br />
),<br />
),<br />
)<br />
Starting from version 1.0.7, <strong>Yii</strong> supports logging call stack information in the messages that<br />
are logged by calling <strong>Yii</strong>::trace. This feature is disabled by default because it lowers<br />
performance. To use this feature, simply define a constant named YII_TRACE_LEVEL at<br />
the beginning of the entry script (before including yii.php) to be an integer greater than 0.<br />
<strong>Yii</strong> will then append to every trace message with the file name and line number of the call<br />
stacks belonging to application code. The number YII_TRACE_LEVEL determines how<br />
many layers of each call stack should be recorded. This information is particularly useful<br />
during development stage as it can help us identify the places that trigger the trace<br />
messages.<br />
Performance Profiling<br />
Performance profiling is a special type of message logging. Performance profiling can be<br />
used to measure the time needed for the specified code blocks and find out what the<br />
performance bottleneck is.<br />
To use performance profiling, we need to identify which code blocks need to be profiled.<br />
We mark the beginning and the end of each code block by inserting the following methods:<br />
<strong>Yii</strong>::beginProfile('blockID');<br />
...code block being profiled...<br />
<strong>Yii</strong>::endProfile('blockID');<br />
where blockID is an ID that uniquely identifies the code block.