CDbLogRoute extend

Hi all, how can extend CDbLogRoute class for add custom string in log events ? Actually I split a single string (message param)separated by comma :(


the fundamental problem in my case is that there is no property Autodump and autoflush in clogroute, only in Clogger

this is only an example:

class ELog extends CDbLogRoute {


protected function createLogTable($db,$tableName) {




ALTER TABLE $tableName

ADD datetime timestamp default CURRENT_TIMESTAMP,

ADD text TEXT default NULL,

ADD type VARCHAR(10) default NULL,

ADD value VARCHAR(50) default NULL,

ADD id_user int(11) default NULL,

ADD ip VARCHAR(13) default NULL,

ADD lang VARCHAR(5) default NULL,

ADD httpinfo VARCHAR(255),

ADD ishtml tinyint(1) unsigned default '0'






	protected function processLogs($logs)



INSERT INTO {$this->logTableName}

(level, category, logtime, message, ip, httpinfo, type, text, id_user, value) VALUES

(:level, :category, :logtime, :message, :ip, :httpinfo, :type, :text, :id_user, :value)




		foreach($logs as $log)







			//personalized fields

			$command->bindValue(':ip', 		$this->getrealip());

			$command->bindValue(':httpinfo',	$this->gethttpinfo());

			$command->bindValue(':id_user',		Yii::app()->user->getId());



			$command->bindValue(':type',	(!isset($elog['type'])?null:$elog['type']));

			$command->bindValue(':text',	(!isset($elog['text'])?null:$elog['text']));

			$command->bindValue(':value',	(!isset($elog['value'])?null:$elog['value']));





in config/main.php














in your code:

Yii::log('this is a test', 'elog');

Yii::log(CJSON::encode(array('type'=>'neworder', 'text'=>'order n┬║xxxx succesfully saved', 'value'=>'xxxx')), 'elog');

For more detail visit

Error logs save in Db in Yii