Cweblogroute Problem

Hi guys,

I have a problem, that I cannot solve on my own. After updating to the most recent framework version I noticed that PHP wouldn’t throw me any errors on my development environment. Checked error_reporting etc., everything correct.

Then I fooled around with the CLogRouter routes and after adding “error” to my CWebLogRoute’s levels, errors would be shown in browser again. Huh? And if I remove the CWebLogRoute route, remove “error” again or add “trace” (because I really like the trace feature…) to it’s levels no errors are shown!!! I also tried adding another CWebLogRoute route, tried with CFileLogRoute, etc. nothing works…

In over a year I never had this problem before. I need your help.

Thank you very much,

Dmx

Has anyone an idea? I can’t even see PHP warnings in my Yii application anymore… it’s somehow related to the “log” component, but I can’t get my head around it.

Can you include your config?

Sure, thank you for your time. Here is what I found out so far:

Without "log" set I cannot see PHP errors nor are they logged on any level.


'log'=>array(

				'class'=>'CLogRouter',

				'routes'=>array(

					array(

						'class'=>'CWebLogRoute',

						'levels'=>'error, warning, info',

					),

				),

			),

Above config allows me to see PHP errors again.


'log'=>array(

				'class'=>'CLogRouter',

				'routes'=>array(

					array(

						'class'=>'CWebLogRoute',

						'levels'=>'error, warning, info, trace',

					),

				),

			),

Or any other combination of levels including "trace" will again hide any PHP errors.

Also adding a second route, or change it to “CFileLogRoute” doesn’t change anything…

I don’t see anything wrong with your config. I use this and have had no issues -




$components = array();


// ...


$components['log'] = array(

          'class'=>'CLogRouter',

          'routes'=>

          array(

                        /* Log errors and warnings to : runtime/error.txt */

                        array(

                                  'class'=>'CFileLogRoute',

                                  'levels'=>'error, warning',

                                  'logFile'=>'error.txt',

                                  ),

                        /* Log info and trace messages : runtime/debug.txt */

                        array(

                                  'class'=>'CFileLogRoute',

                                  'levels'=>'info, trace',

                                  'logFile'=>'debug.txt',

                                  ),


                        ),

        );


if (YII_DEBUG) {

   /* If debugging, display errors and warnings to the browser */

  $components['log']['routes'][] =

      array(

         'class'=>'CWebLogRoute',

         'levels'=>'error, warning',

   );


   /* Profiling */

  $components['log']['routes'][] =

      array(

         'class'=>'CProfileLogRoute',

         'levels'=>'error, warning, info, trace',

   );

}


// ...


$settings = array(

   'basePath' => $basePath,

   'components' => $components,

   'import' => $import,

   'modules' => $modules,

   'name' => $name,

   'params' => $params,

   'preload' => $preload,

);

return $settings;



I have spent hours trying to find out what is causing this issue.

  • error_reporting(E_ALL);

  • ini_set(‘display_errors’, ‘on’);

  • define(‘YII_DEBUG’, true);

I only get a blank page instead of a parsing errors with these settings if I don’t have CWebLogRoute’s levels set to “error” excluding “trace”. Right now I’m working with constantly editing the config on every blank page to see parse errors so I can keep the “trace” feature in.

Did you try the config I posted?

I did, same issue. No parse errors are displayed. When I remove the “CProfileLogRoute” route which includes “trace”, errors are shown again… :(

Nobody else facing this problem? I still haven’t found a solution for this…

I saw this happen when I had bad syntax. e.g:




...

   'levels' => 'error, warning,' trace,' info',



note extra apostrophes