3

在网上广泛搜索后,我仍然无法弄清楚这一点。CWebLogRoute 不显示 SQL 调试信息,但 CFileLogRoute 显示。关于如何让 CWebLogRoute 工作的任何想法?谢谢!

这是我的配置文件:

'db'=>array(
    'connectionString' => 'mysql:host=localhost;dbname=myname',
    'emulatePrepare' => true,
    'username' => 'root',
    'password' => 'root',
    'charset' => 'utf8',
    'enableParamLogging'=>true,
    'enableProfiling'=>true,
),

'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        array(
            'class'=>'CFileLogRoute',
            'levels'=>'error, warning, trace, info',
        ),
        array(
            'class'=>'CWebLogRoute',
            'levels'=>'error, warning, trace, info',
        ),
  )
4

3 回答 3

3

它至少显示了一些东西吗?它在我本地运行良好。尝试添加profileCWebLogRoute.levels. 顺便说一句,我更CProfileLogRoute喜欢sql

array(
    'class'=>'CProfileLogRoute',
    'enabled'=> YII_DEBUG,
),
于 2012-08-18T22:50:36.307 回答
0

你的 yii 框架是什么版本的?并设置级别 '' 。

'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            array(
                'class'=>'CFileLogRoute',
                // 'levels'=>'error, warning',
            ),
            // uncomment the following to show log messages on web pages
            array( // configuration for the toolbar
              'class'=>'XWebDebugRouter',
              'config'=>'alignRight, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
              // 'levels'=>'error, warning, trace, profile, info',
              'allowedIPs'=>array('127.0.0.1','::1','192.168.10.195','192\.168\.1[0-5]\.[0-9]{3}'),
            ),
        ),

    ),
于 2014-07-08T09:08:52.110 回答
0

这并不能直接回答您的问题,但我发现 Yii 调试工具栏是我最近一直在做的工作的一个很棒的附加组件。它不仅会显示您正在运行的 SQL 语句(文字语句,而不是参数化版本),而且还会显示您确实经常需要的许多其他信息......

你可以在这里得到它:http ://www.yiiframework.com/extension/yii-debug-toolbar/

于 2012-08-19T02:22:05.090 回答