Joyal
Joyal

Reputation: 2693

show stack trace in yii framework

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

Upvotes: 5

Views: 14902

Answers (4)

user3620440
user3620440

Reputation:

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',
            ),

        ),
    ),

Upvotes: 2

acorncom
acorncom

Reputation: 5955

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

Upvotes: 2

NadaNK
NadaNK

Reputation: 802

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.*',
                ),
         )

Upvotes: 0

Ansari
Ansari

Reputation: 8218

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!

Upvotes: 10

Related Questions