Yii2.0 Chinese Development Wizard--Custom log file write log, yii2.0 log file _php tutorial

Source: Internet
Author: User
Tags yii

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-...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.