0

in my controller:

private $log_category   = "application.event";
private $log_info           = "info";

then I log like this (in the same controller):

Yii::trace("actionIndex", $log_category);
Yii::log("saved",$log_info,$log_category);

but it doesn't work: the logs don't appear in the log file. Here's the config:

'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error,warning,info,trace',
                    'categories' => 'application'
                ),
            ),

neither "*" nor "application.*" works; but if I remove the categories parameter altogether (or put it to empty), I get system messages in the log - this means the log file is being written and that somehow my categories are wrong.

How to define the category?

4

1 に答える 1

3

$thisクラスプロパティを呼び出すときにが欠落しています:

Yii::trace("actionIndex", $this->log_category);
Yii::log("saved",$this->log_info,$this->log_category);
于 2012-11-28T21:11:46.600 に答える