show stack trace in yii framework
Asked Answered
T

4

5

we get stack trace when an error occurs in the execution, like in the following picture .

see this

I would like to see this tracing at the bottom of the page every time I executes a page. ( even without errors) so that I can find out what are the pages ran and what is happening inside the framework

How can I activate this ?

Thank you very much

Thatch answered 31/8, 2012 at 5:59 Comment(0)
H
10

A "stack trace" doesn't make much sense outside of an error scenario, but you can see what Yii is up to by enabling the debug mode. In your index.php add

defined('YII_DEBUG') or define('YII_DEBUG',true);

and in the log component of your main Yii configuration array (config/main.php), add this array under the routes component:

            array(
                'class'=>'CWebLogRoute',
                'enabled' => YII_DEBUG,
            ),

This should show you what you want.

Make sure to remove the YII_DEBUG line from your production code!

Homy answered 31/8, 2012 at 6:19 Comment(4)
Thanks but I would like to get more details.Thatch
More details on what specifically?Homy
Remember to add the defined('YII_DEBUG') or define('YII_DEBUG',true); line before including yii.php or yiilite.php.Ploch
How should I get this in Yii2 ?Shipper
M
2

There is a lot of tracing information available in the Yii debug toolbar: http://www.yiiframework.com/extension/yii-debug-toolbar/

Might be what you are after

Mekka answered 31/8, 2012 at 12:58 Comment(0)
H
2

You can open these line of code in your project config/main.php

'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            array(
                'class'=>'CFileLogRoute',
                'levels'=>'error, warning',
            ),
            // uncomment the following to show log messages on web pages

             array(
                'class'=>'CWebLogRoute',
            ),

        ),
    ),
Heisler answered 9/5, 2014 at 13:17 Comment(0)
B
0

If you defined the file log routing in the config file, you can see the logs in the log file stored in runtime directory.

File log routing is defined like this:

...
'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'trace, info',
                    'categories'=>'system.*',
                ),
         )
Bionics answered 31/8, 2012 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.