Table of Contents
Yii2.0 Chinese Development Wizard - Customize log files to write logs, yii2.0 log files
Home Backend Development PHP Tutorial Yii2.0 Chinese Development Wizard - Custom log file writing log, yii2.0 log file_PHP tutorial

Yii2.0 Chinese Development Wizard - Custom log file writing log, yii2.0 log file_PHP tutorial

Jul 13, 2016 am 09:45 AM
log file

Yii2.0 Chinese Development Wizard - Customize log files to write logs, yii2.0 log files

Introduce the log class in the header
use yiilogFileTarget;


$time = microtime(true);
$log = new FileTarget();
$log->logFile = Yii::$app->getRuntimePath() . '/logs /zhidemy.com.log'; //Customized file name
$log->messages[] = ['test',1,'application',$time];
$log->export ();


This can basically be written. First, take a look at the class description information of $log->message
/*
* [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)
*/

Just pass the parameters according to this information. Finally, remember the important point
$log->messages[] Don’t forget to add []
For details, please view the Target class

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1043456.htmlTechArticleYii2.0 Chinese Development Wizard - Customize the log file to write the log, and introduce the log into the header of the yii2.0 log file Class use yiilogFileTarget; $time = microtime(true); $log = new FileTarget(); $log-...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Python script to monitor network connections and save to log file Python script to monitor network connections and save to log file Sep 01, 2023 am 10:41 AM

Monitoring network connections is critical to ensuring the stability and security of your computer system. Whether you are a network administrator or an individual user, having a way to track network connections and log related information can be invaluable. In this blog post, we will explore how to create a Python script to monitor network connections and save the data to a log file. By leveraging the power of Python and its rich libraries, we can develop a script to periodically check network status, capture relevant details such as IP address, timestamp, and connection status, and store them in a log file for future use refer to. This script not only provides real-time insights into network connections, but also provides historical records that aid in troubleshooting and analysis. Set up the environment before starting to write P

Linux server log is too large, how to solve it? Linux server log is too large, how to solve it? Jun 29, 2023 pm 11:09 PM

Common problems of too-large log files on Linux servers and their solutions. With the rapid development of the Internet and the widespread use of servers, it has become a common problem that server log files are getting larger and larger. A large amount of log data not only takes up disk space, but may also affect the performance and operational stability of the server. This article will discuss the common problem of too large log files on Linux servers and provide some solutions. 1. Common log files on Linux servers. Common log files include system logs, application logs, We

Where are the win10 log files? Where are the win10 log files? Jan 05, 2024 am 08:15 AM

The win10 log can help users understand the system usage in detail, and can help users record usage and problems. Many new users may not know how to open it. Let’s take a look at its detailed tutorial below. Where are the win10 log files: 1. Open "Control Panel" in settings 2. Click "Administrative Tools" 3. Find "Event Viewer" 4. Double-click "Windows Log" to open

Windows log files are located in C:\Windows\system32\logfiles Windows log files are located in C:\Windows\system32\logfiles Dec 22, 2023 pm 05:43 PM

Many users have encountered the situation of c: Windows\system32\logfiles on the win10 system. Nothing happens when pressing anything. Today, let’s take a look at how to solve this problem. win10 log file c: Windows\system32\logfiles: 1. Open the run, enter regedit to open, find HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellFolders, find "desktop" on the right, right-click to modify, and change the

Common log file permission errors on Linux servers and how to fix them Common log file permission errors on Linux servers and how to fix them Jun 29, 2023 am 09:02 AM

Title: Common log file permission errors on Linux servers and how to fix them When running a Linux server, log files are very important. Successfully managing and protecting your server's log files is key to ensuring server security and stability. However, due to misconfiguration, attacks, or unexpected circumstances, log file permission errors may occur, resulting in limited access to the log file or the inability to write to the log. This article discusses some common log file permission errors and provides corresponding fixes to help administrators resolve the issue.

Is it possible to delete Win10 log files? Is it possible to delete Win10 log files? Dec 26, 2023 pm 06:37 PM

The logs of win10 can help users understand the system usage in detail, and can help users record usage and problems. Most users will worry about whether its log files can be deleted. Let’s take a look at its details below. Can win10 log files be deleted? 1. The logs folder is the system log folder. This folder is used to record information about hardware, software and system problems in the system. It also monitors events that occur in the system, such as when our computer just If there is a problem with the computer crashing or automatically restarting, we can use it to check the cause of the error, or if the computer is attacked, we can also find traces of the attack from this folder. So the folder can be deleted. 2. We have performed any operations in the Win10 system,

Shell is an efficient command for analyzing log files, super easy to use! Shell is an efficient command for analyzing log files, super easy to use! Aug 01, 2023 pm 04:47 PM

My own small website runs on Alibaba Cloud's ECS. I occasionally analyze my website server logs to see the number of visits to the website. See if there are any hackers causing damage! So I collected and sorted out some server log analysis commands. You can try them!

Common log file corruption problems on Linux servers and their repair methods Common log file corruption problems on Linux servers and their repair methods Jun 29, 2023 pm 06:00 PM

Common log file corruption problems on Linux servers and their repair methods Summary: Log files are a very important part of the Linux server. They record various operations and events during the operation of the system. However, due to various reasons, log files sometimes become corrupted, preventing the server from normal analysis and debugging. This article will discuss some common log file corruption problems and provide corresponding solutions. Introduction: Log files play a vital role in the operation of a Linux server. they recorded

See all articles