kan saya mau pas saya jalanin consolenya dy tulis file log…
pas saya jalanin di console dy ga error…tapi ga nulis log file nya…
ni halaman console.php
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../../yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/console.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',TRUE);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createConsoleApplication($config)->run();
command/DemooCommand.php
<?php
class DemooCommand extends CConsoleCommand {
public function run($args)
{
$connection = Yii::app()->db;
$sql="select * from tbl_batch where jobs_id = groar ";
$command = $connection->createCommand($sql)->queryAll();
}
}
config/console.php
<?php
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Console Application',
'params'=>array(
'testparam'=>'testvalue',
),
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.user.models.*',
'application.modules.user.components.*',
'application.modules.rights.models.*',
'application.modules.rights.components.*',
'application.extensions.*',
//'application.extensions.menu.*',
//'application.extensions.menu.resources.*',
//'application.modules.Classes.*',
//'application.modules.Classes.PHPExcel.*',
),
'modules'=>array(
// uncomment the following to enable the Gii tool
'rights'=>array(
'install'=>true,
'superuserName'=>'Admin',
'authenticatedName'=>'Authenticated',
'userClass'=>'Users',//class tablenya
'userIdColumn'=>'id',
'userNameColumn'=>'username',
),
'user',
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'superdodo',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),
// application components
'components'=>array(
'user'=>array(
'class'=>'RWebUser',
'allowAutoLogin'=>true,
'loginUrl' => array('/user/login'),
),
'authManager'=>array(
'class'=>'RDbAuthManager',
'connectionID'=>'db',
),
// 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=cbc',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'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',
'logFile'=>'LOGFILE',
'logPath'=>'C:/xampp/htdocs/cbc/',
'levels'=>'error, warning , trace',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),*/
),
),
),
);
saya jalaninya
apa ada yang saya salah tulis??