Yii don't understand how to log a message
13,073
Solution 1
I was in a similar trouble with YII logger. Strange but I was kind of messing with parameter order.
This works for me:
<?php
Yii::log('', CLogger::LEVEL_ERROR, 'Message Here...');
Solution 2
Right way to write to log is:
Yii::log($message, $level, $category);
But point is that $category should not be empty.
Example above works becouse message is written in category then category is not empty, but it writes empty message. It writes category so it looks like message.. but it isn't.
Author by
Ismail Marmoush
You can check my website and blog https://marmoush.com
Updated on June 10, 2022Comments
-
Ismail Marmoush almost 2 years
I followed this tutorial but still I go to the webpage refresh, then go to the file and still I can't find the log message I sent I wrote the following line in a controller:
Yii::log("Index Checkout",CLogger::LEVEL_ERROR);
And My configurations:
'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', ), */ ),