public function init() { date_default_timezone_set("PRC"); $tableId = Log::getLogTableId(); $this->logTableName = Log::getTableName($tableId); parent::init(); }
public function processLogs($logs) { parent::processLogs($logs); $count = $this->getDbConnection()->createCommand('SELECT COUNT(*) FROM ' . $this->logTableName)->queryScalar(); if ($count >= LOGGER_TABLE_MAX_RECORDS) { $query = "DELETE FROM {$this->logTableName} limit 200"; $command = Yii::app()->db->createCommand($query); $command->execute(); } }
public function init() { parent::init(); Yii::getLogger()->autoFlush = 1; Yii::getLogger()->autoDump = true; }