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',
),
*/
),
yii\log\DbTarget − Stores log messages in a database. yii\log\FileTarget − Saves log messages in files. yii\log\EmailTarget − Sends log messages to predefined email addresses. yii\log\SyslogTarget − Saves log messages to syslog by calling the PHP function syslog().
yii\log\DbTarget: stores log messages in a database table. yii\log\EmailTarget: sends log messages to pre-specified email addresses. yii\log\FileTarget: saves log messages in files.
If it's apache, you can find php errors in error_log. Then look into the yii runtime log. Yii can only catch runtime errors. For compile time/syntax errors are only reported in php error log, which I think is why you see blank screen.
Usage. Once the extension is installed, simply modify your application configuration as follows: return [ 'bootstrap' => ['debug'], 'modules' => [ 'debug' => [ 'class' => 'yii\debug\Module', // uncomment and adjust the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With