i have enabled profiling to be displayed in yii as below shown.
'db'=>array(
'connectionString'=>'pgsql:host=localhost;port=5432;dbname=ijob_css',
'username'=>'postgres',
'password'=>'allion123',
'enableProfiling'=>true,
'schemaCachingDuration'=>604800
),
but still i am not getting anything displayed under the pages of website and its empty.
before it worked and recently i swiotched off by
'enableProfiling'=>false
why doesn't it work ? i must be missing something.
Adding this to main config resolved the issue. 'class'=>'CProfileLogRoute',
'components'=>array(
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
array(
'class'=>'CProfileLogRoute',
),
Related
I am a newbie to yii and I am installing extension auditTrail.
I have made all the required changes to my main.php config file but everytime it is showing the same error
'Alias "auditTrail.AuditTrailModule" is invalid. Make sure it points
to an existing PHP file and the file is readable.'
Please help me out. thankyou in advance.. my editted file is here:
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.auditTrail.models.AuditTrail',
),
'modules'=>array(
'auditTrail'=>array(),
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>false,
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=assetdb',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'Preksha#12',
'charset' => 'utf8',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'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',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster#example.com',
),
);
here is the error ::
CException
Alias "auditTrail.AuditTrailModule" is invalid. Make sure it points to an existing PHP file and the file is readable.
I have used Codeigniter before and it has a feature that will echo the last database query - really useful for debugging.
eg...
$this->getSomeData->findAll();
Yii command to output this single query e.g SELECT * FROM TABLE...
Does Yii have a similar feature to simply show the very last query executed?
Try this in your config file. You can see the query and other details at the bottom of the page.
'db'=>array(
'enableProfiling'=>true,
'enableParamLogging' => true,
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
…
array(
'class'=>'CProfileLogRoute',
'levels'=>'profile',
'enabled'=>true,
),
),
),
'errorHandler' => array(
'class' => 'ErrorHandler',
'errorAction' => 'page/find',
),
http://shot.qip.ru/008pAk-4IA4wMhU6/
I have standard error handling with beautiful error page. But for develop environment I need standard stacktrace on it below.
Examlpe: http://shot.qip.ru/008pAk-4IA4wMhU7/
If I comment 'errorAction' I can see just standart stacktrace, in other case I cant display this stacktrace.
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class' => 'CWebLogRoute',
'categories' => 'application, exception.*',
'levels'=>'error, warning, trace, profile, info',
'showInFireBug' => true,
'enabled' => YII_DEBUG,
),
array(
'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
'ipFilters'=>array('127.0.0.1','192.168.0.100'),
),
array(
'class'=>'CProfileLogRoute',
'report'=>'summary',
// Shows the execution time of each labeled with a code block.
// The value of "report" can also be specified as a "callstack".
),
),
),
Error handler by default uses two types of views for
Production named as error.php;
Development named as named as exception.php;
Based on your routing and error handler code. I see you have defined a custom error action
You will have to place your custom Errors views in either of the following folders, in the format specified in the link below and use the standard error action.
themes/ThemeName/views/system: when a theme is active.
protected/views/system
See this Documentation for detailed explanation
Reference: http://www.yiiframework.com/doc/api/1.1/CErrorHandler
Try this extenstion http://www.yiiframework.com/extension/yii-debug-toolbar/
The Yii Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content.
It is a ported to PHP famous Django Debug Toolbar.
After extensive search on the web, I still can't figure this out. CWebLogRoute doesn't show SQL debug info, but CFileLogRoute does. Any ideas on how to get CWebLogRoute to work? Thanks!
Here is my config file:
'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',
),
)
Does it show at least something? It's working fine on my local. Try to add profile into CWebLogRoute.levels.
BTW I prefer CProfileLogRoute for sql:
array(
'class'=>'CProfileLogRoute',
'enabled'=> YII_DEBUG,
),
This doesn't directly answer your question, but I've found the Yii debug toolbar to be a fantastic add-on on a job I've been doing recently. It will display not only the SQL statements you are running (the literal ones, not the parameterized versions), but also has a lot of other information that you actually do need fairly regularly ...
You can get it here: http://www.yiiframework.com/extension/yii-debug-toolbar/
what's the version of your yii framework?
and set the levels '' .
'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}'),
),
),
),
I am new to the beautiful Yii Framework. So I am just going through the tutorials and documentation. So I am doing the blog tutorial from starting. So for blog application I made export the database from the blog folder which comes with Yii to MySQL. Again I decided to use Yii User module and for that I made export the user module database to MySQL. Now my problem is that when I am using login in the application it is showing some error like this
Trying to get property of non-object
I both tried index.php?r=site/login and also index.php?r=user/login both failed. So can some one tell me how to solve this. FYI in my database there are two fields like 'ia_user' which is imported from the blog folder and 'ia_users' which is imported from the Yii User module folder. So is there any thing wrong. Below I am pasting the configuration of main.php file.
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Blog Application',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
/*user module starts here*/
'application.modules.user.models.*',
'application.modules.user.components.*',
/*user module ends here*/
),
'modules'=>array(
// uncomment the following to enable the Gii tool
/*
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'Enter Your Password Here',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
*/
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
/*user module starts here*/
'loginUrl' => array('/user/login'),
/*user module ends here*/
),
// uncomment the following to enable URLs in path-format
/*
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
*/
//'db'=>array(
// 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
//),
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=tbl_blog',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'tablePrefix'=> 'tbl_',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'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',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster#example.com',
),
);
Please help me out.Any help and suggestions will be highly appreciable.I asked help from Yii forum but not got any reply So I am asking for help here .
I had to add user in array of modules just like this
'user'=>array(
'user'
// enable cookie-based authentication
'allowAutoLogin'=>true,
/*user module starts here*/
'loginUrl' => array('/user/login'),
/*user module ends here*/
),