Yii2.0 Chinese Development Wizard--Custom log file write log, yii2.0 log file
Head Introduction to log Class
Use Yii\log\filetarget;
$time = Microtime (true);
$log = new Filetarget ();
$log->logfile = Yii:: $app->getruntimepath (). '/logs/zhidemy.com.log ';//File name customization
$log->messages[] = [' Test ', 1, ' Application ', $time];
$log->export ();
This basically can be written out, first look at the $log->message class description information
/*
* [0] = = Message (mixed, can be a string or some complex data, such as an exception object)
* [1] = level (integer)
* [2] = category (String)
* [3] = timestamp (float, obtained by Microtime (true))
* [4] = = Traces (array, debug BackTrace, contains the application code call stacks)
*/
The pass-through parameters are passed on with this information. Finally remember the important point
$log->messages[] Don't forget to add []
The target class can be viewed specifically
http://www.bkjia.com/PHPjc/1043456.html www.bkjia.com true http://www.bkjia.com/PHPjc/1043456.html techarticle Yii2.0 Chinese Development Wizard--Custom log file write log, yii2.0 log file header Introduction Log class use Yii\log\filetarget; $time = Microtime (true); $log = new Filetarget ( ); $log-...