Yii does not understand how to register a message

I followed this tutorial , but still I go on to update the webpage, then go on to the file, and yet I cannot find the log message I sent I wrote the following line in the controller:

Yii::log("Index Checkout",CLogger::LEVEL_ERROR); 

And my settings:

 'log' => array( 'class' => 'CLogRouter', 'routes' => array( array( 'logFile'=>'trace.log', 'class' => 'CFileLogRoute', 'levels' => 'error,info, warning', ), // uncomment the following to show log messages on web pages /* array( 'class'=>'CWebLogRoute', ), */ ), 
+4
source share
2 answers

I had a similar problem with the YII logger. Strange, but I kind of messed around with the order of the parameters.

This works for me:

 <?php Yii::log('', CLogger::LEVEL_ERROR, 'Message Here...'); 
+5
source

The correct way to write to the log is:

 Yii::log($message, $level, $category); 

But the fact is that $ category should not be empty .

The example above works because the message is written in a category, then the category is not empty, but it writes an empty message. He writes a category, so it looks like a message .. but it is not.

+8
source

Source: https://habr.com/ru/post/1395409/


All Articles